mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-24 21:53:37 +02:00
Compare commits
463
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0066e8f352 | ||
|
|
ab1a1a2299 | ||
|
|
bb8a261bb8 | ||
|
|
b3e6e23ffd | ||
|
|
e46663cf38 | ||
|
|
e7a41e864f | ||
|
|
ae540e2396 | ||
|
|
14e06ccea4 | ||
|
|
a185b440ef | ||
|
|
14378de263 | ||
|
|
1fa7f3caec | ||
|
|
b99a455873 | ||
|
|
d1708cbd65 | ||
|
|
a14d4322ac | ||
|
|
5385f329c6 | ||
|
|
fd8e6a0364 | ||
|
|
884dcde3c3 | ||
|
|
cc92ca36b7 | ||
|
|
556ca510d4 | ||
|
|
66e7af4993 | ||
|
|
6ce8f95553 | ||
|
|
b626f65ee5 | ||
|
|
f297287951 | ||
|
|
ef81fbd337 | ||
|
|
84f580e207 | ||
|
|
4c818c31ed | ||
|
|
82e4518e93 | ||
|
|
b8860362a3 | ||
|
|
37e78942ed | ||
|
|
c74378bade | ||
|
|
fef1e09542 | ||
|
|
1b082ac255 | ||
|
|
7b583b1aac | ||
|
|
8113ed23b9 | ||
|
|
eb0f2974ab | ||
|
|
70397c6131 | ||
|
|
4ef89bb387 | ||
|
|
fbe6e6193f | ||
|
|
77b3035308 | ||
|
|
17f7982215 | ||
|
|
5275e589f5 | ||
|
|
5b910f8761 | ||
|
|
ac477cf8b2 | ||
|
|
082a90ec4f | ||
|
|
3826091357 | ||
|
|
d26c691458 | ||
|
|
21d4571d5b | ||
|
|
9765e30e2f | ||
|
|
2638160548 | ||
|
|
b229329d31 | ||
|
|
7182877105 | ||
|
|
360268ea39 | ||
|
|
7f5807a6b5 | ||
|
|
63beea6043 | ||
|
|
290e43ff66 | ||
|
|
8cf074444f | ||
|
|
a430c713e3 | ||
|
|
574c6afe05 | ||
|
|
33fca5fd5d | ||
|
|
53bd3517db | ||
|
|
b05b1f1997 | ||
|
|
8cc7537899 | ||
|
|
d971aada83 | ||
|
|
02d6d4937a | ||
|
|
b662349832 | ||
|
|
055e69520f | ||
|
|
e963079712 | ||
|
|
5d158dbed6 | ||
|
|
e336d9fb77 | ||
|
|
2d88625f4e | ||
|
|
34f95771d8 | ||
|
|
d50ff75b44 | ||
|
|
87289d57ea | ||
|
|
b5e3cb6122 | ||
|
|
53c364deec | ||
|
|
431c9641ea | ||
|
|
a9108a2e77 | ||
|
|
1a95bf0807 | ||
|
|
4d23a89918 | ||
|
|
cc1b6f0c45 | ||
|
|
34febc214f | ||
|
|
cd778ff82f | ||
|
|
725b00e6ae | ||
|
|
6035a5fa5a | ||
|
|
f9e67732e2 | ||
|
|
9750455b76 | ||
|
|
479554024d | ||
|
|
b5dc20260c | ||
|
|
10aaee1290 | ||
|
|
84978f8acc | ||
|
|
497b261acd | ||
|
|
afc07ec565 | ||
|
|
3c0931b744 | ||
|
|
fde5bd02d7 | ||
|
|
00f78c1964 | ||
|
|
6e654c8193 | ||
|
|
dfaebc6b88 | ||
|
|
b3a0ed815b | ||
|
|
54d28325b9 | ||
|
|
42aec92642 | ||
|
|
86d52f4712 | ||
|
|
10685c7d0d | ||
|
|
513a6c2fda | ||
|
|
caabd98100 | ||
|
|
3316223629 | ||
|
|
fe8d8a972c | ||
|
|
55fe064af4 | ||
|
|
e2e5ef1d31 | ||
|
|
c5158c77b4 | ||
|
|
458da959f5 | ||
|
|
620fdbc530 | ||
|
|
3536aeafd6 | ||
|
|
db4d5e4815 | ||
|
|
41a269faa9 | ||
|
|
379e26ac99 | ||
|
|
82ac0503b5 | ||
|
|
b778f44681 | ||
|
|
a9c35c8e85 | ||
|
|
3c6054ce4e | ||
|
|
ba471094c5 | ||
|
|
9b96c2a797 | ||
|
|
ed8babaf41 | ||
|
|
44380e7507 | ||
|
|
36a6e7c5a6 | ||
|
|
d4cba2529e | ||
|
|
315c207797 | ||
|
|
5fb7d4a0a1 | ||
|
|
46ce1943b7 | ||
|
|
71c3fea199 | ||
|
|
714e95a56e | ||
|
|
a9cdb1ad4d | ||
|
|
7fd47811cb | ||
|
|
2ec9764ac4 | ||
|
|
8c02b89a93 | ||
|
|
3c0f1aebec | ||
|
|
8e81e6223d | ||
|
|
933cb6d67a | ||
|
|
d31809042b | ||
|
|
30a5cd508a | ||
|
|
7c88140df2 | ||
|
|
d43e93eb81 | ||
|
|
d1a8cfb861 | ||
|
|
428bddade9 | ||
|
|
f8a6d27b27 | ||
|
|
df75efa78d | ||
|
|
330b423ee9 | ||
|
|
36c234fd90 | ||
|
|
fce7450bbf | ||
|
|
671afabfc2 | ||
|
|
5e3d87858f | ||
|
|
65165dbc55 | ||
|
|
61bcbc5906 | ||
|
|
0d292bdb3c | ||
|
|
e0589c302b | ||
|
|
16ae40d383 | ||
|
|
ad9edb0256 | ||
|
|
b71e8c1dfc | ||
|
|
e67340f1c5 | ||
|
|
2493f13baa | ||
|
|
d007025e0f | ||
|
|
683677b5aa | ||
|
|
907b0ca6ee | ||
|
|
3446239371 | ||
|
|
00303b7165 | ||
|
|
d54f8e839e | ||
|
|
9f1619520e | ||
|
|
bb347c2c8c | ||
|
|
0ad43bc7d2 | ||
|
|
c7ac60f312 | ||
|
|
a51c22a7a3 | ||
|
|
46bc9a7ed8 | ||
|
|
3401cade6e | ||
|
|
7676dfd95e | ||
|
|
2273672415 | ||
|
|
942f23ca0b | ||
|
|
f9cf6b935a | ||
|
|
5b446077e6 | ||
|
|
0f4b9a4383 | ||
|
|
8074b3a004 | ||
|
|
b7826c5f9a | ||
|
|
fb9b3aeab7 | ||
|
|
160e764c4c | ||
|
|
dfa5fbf92d | ||
|
|
b1d02ce571 | ||
|
|
0601d5fa8d | ||
|
|
5ccbbdf61b | ||
|
|
83b44e3feb | ||
|
|
1c4aba1d43 | ||
|
|
9a355d784b | ||
|
|
4f540b9cbb | ||
|
|
b231c6c269 | ||
|
|
e92cc49459 | ||
|
|
3e24bb1dc9 | ||
|
|
b8a63eb73d | ||
|
|
bba0bf3726 | ||
|
|
bf29112d56 | ||
|
|
843deb2f6b | ||
|
|
76c1e643fa | ||
|
|
a7e7ea4ccf | ||
|
|
e2401417ef | ||
|
|
d90cd6f5ee | ||
|
|
509d4f2cec | ||
|
|
49310cd5a6 | ||
|
|
3a1ea97cb4 | ||
|
|
072a4680be | ||
|
|
0eec0f8ec9 | ||
|
|
725811baa9 | ||
|
|
39dd578d45 | ||
|
|
37b809b296 | ||
|
|
a80542d67d | ||
|
|
a3657e112a | ||
|
|
7d7375556c | ||
|
|
c97c71951c | ||
|
|
81c7fb1a26 | ||
|
|
b63eddd4cd | ||
|
|
d536b3d2cc | ||
|
|
e8776bc80d | ||
|
|
920ff4d072 | ||
|
|
1d56c6ed0f | ||
|
|
2a20bc7209 | ||
|
|
df0040791e | ||
|
|
cc8c7fc4de | ||
|
|
7e2f6d4af8 | ||
|
|
4c15108233 | ||
|
|
1667644e3d | ||
|
|
6476e9442e | ||
|
|
a05be24b48 | ||
|
|
7d2ebaf265 | ||
|
|
e606b52c39 | ||
|
|
7cbcd8f9fa | ||
|
|
d270e9a513 | ||
|
|
fe8145e750 | ||
|
|
39d7c47f04 | ||
|
|
be2714672b | ||
|
|
ccc159b3d9 | ||
|
|
3a88df2c38 | ||
|
|
fbf4b000ef | ||
|
|
356eeb3ae6 | ||
|
|
a2418218a6 | ||
|
|
ac4f02c4ac | ||
|
|
371d2ca1e7 | ||
|
|
4c3997e7a2 | ||
|
|
e40235ffb0 | ||
|
|
8d14b53047 | ||
|
|
47cf45ad54 | ||
|
|
30dbf80507 | ||
|
|
c27917ebf9 | ||
|
|
0c79d19b48 | ||
|
|
1402537900 | ||
|
|
aa13651a03 | ||
|
|
980a165dc9 | ||
|
|
317f58fa31 | ||
|
|
1d05e82f25 | ||
|
|
c5a37aed84 | ||
|
|
f84ff413a1 | ||
|
|
76671cf453 | ||
|
|
ea8048376f | ||
|
|
063923308f | ||
|
|
99cea94aaf | ||
|
|
ffb5763206 | ||
|
|
0f8209fade | ||
|
|
7627ef1c5d | ||
|
|
cdc9bc6a21 | ||
|
|
282621e499 | ||
|
|
1c75ff0546 | ||
|
|
d6f3ec2f34 | ||
|
|
b189a4e168 | ||
|
|
d8e19e74ed | ||
|
|
61f17e3c1d | ||
|
|
93c8f8ee21 | ||
|
|
bff4a69a73 | ||
|
|
3b41d938f9 | ||
|
|
05847516fd | ||
|
|
eb4a9cfe1d | ||
|
|
7ef69e3b1c | ||
|
|
643abd95ea | ||
|
|
75f95202b7 | ||
|
|
fed0b38279 | ||
|
|
55e03e92be | ||
|
|
b4163081ba | ||
|
|
b5facb85d1 | ||
|
|
55be7dbfd6 | ||
|
|
bca82a4c6b | ||
|
|
6dca26ed3c | ||
|
|
8ec6eb094f | ||
|
|
aed28415ed | ||
|
|
2e47e5dbda | ||
|
|
1226d9db94 | ||
|
|
57eda5f923 | ||
|
|
dbc7147b47 | ||
|
|
b56ca39562 | ||
|
|
52c7de16f0 | ||
|
|
4d35e0a91c | ||
|
|
16c3b6936a | ||
|
|
2aee52d65f | ||
|
|
94558cdb63 | ||
|
|
f512854b54 | ||
|
|
d78a8bfa33 | ||
|
|
2017578197 | ||
|
|
6ec6c104a8 | ||
|
|
4e269cf863 | ||
|
|
e4e1bcb139 | ||
|
|
45fe62b7ed | ||
|
|
a192e85345 | ||
|
|
0e8c6379f0 | ||
|
|
8a7ba8ae8e | ||
|
|
9df98d8c17 | ||
|
|
14653882ae | ||
|
|
3f63678eaa | ||
|
|
ac9b33dd1a | ||
|
|
470bf3d190 | ||
|
|
41fa94478a | ||
|
|
3c70f99028 | ||
|
|
15995fa19c | ||
|
|
962a685570 | ||
|
|
ae727f0a04 | ||
|
|
784b20038f | ||
|
|
490a21fdff | ||
|
|
864d7b822a | ||
|
|
16ea259e04 | ||
|
|
36430b11c7 | ||
|
|
826ebac51a | ||
|
|
ce5e3a3891 | ||
|
|
21e8e0523f | ||
|
|
bf46c5386a | ||
|
|
da9cce8350 | ||
|
|
9d757589ba | ||
|
|
74220430ea | ||
|
|
dc3ba7cc33 | ||
|
|
19e3a18cde | ||
|
|
66451e6596 | ||
|
|
92fb5f6dc8 | ||
|
|
ef49a86942 | ||
|
|
e8224208a2 | ||
|
|
e3df1539f5 | ||
|
|
3e767dec4f | ||
|
|
068bb14937 | ||
|
|
d91b8d0dfb | ||
|
|
9bf4197e0a | ||
|
|
ee9b927dec | ||
|
|
9e1cd46c73 | ||
|
|
2e272c187f | ||
|
|
910bcc86d0 | ||
|
|
448949ef7a | ||
|
|
33bf91a1da | ||
|
|
9f4c4abaca | ||
|
|
4069448128 | ||
|
|
4720e109b6 | ||
|
|
f3153dc9c1 | ||
|
|
a424e91a54 | ||
|
|
1d0d7164c8 | ||
|
|
1486a30e2f | ||
|
|
88a59374bc | ||
|
|
78eea7face | ||
|
|
90b168aaaf | ||
|
|
2ca7fbfb61 | ||
|
|
2d9ae6cd04 | ||
|
|
0fe078ec8a | ||
|
|
10d785df80 | ||
|
|
728a0e0002 | ||
|
|
3de58bfef4 | ||
|
|
57d3ee0d89 | ||
|
|
e5c4b0927d | ||
|
|
141fbf55f6 | ||
|
|
aad6f7b2d1 | ||
|
|
944b267262 | ||
|
|
caf9aba55e | ||
|
|
109a02c829 | ||
|
|
d849c0eae5 | ||
|
|
7c6e4e64b5 | ||
|
|
93dd72dc26 | ||
|
|
91a09b3ce5 | ||
|
|
7c5a55746a | ||
|
|
a499927784 | ||
|
|
4cc30a1f21 | ||
|
|
fb1824b3b0 | ||
|
|
1193ded996 | ||
|
|
c1873e4499 | ||
|
|
6ca48631aa | ||
|
|
b7b2ed5d34 | ||
|
|
f532c0dc98 | ||
|
|
15009493e0 | ||
|
|
2636bec9a1 | ||
|
|
a7ff14c407 | ||
|
|
0e6c07a149 | ||
|
|
e10f7caecb | ||
|
|
9f4120faf4 | ||
|
|
4789261e1e | ||
|
|
58781d458e | ||
|
|
6fa1212560 | ||
|
|
62188c38ec | ||
|
|
6667deca6f | ||
|
|
302048d29e | ||
|
|
c8b2e62da0 | ||
|
|
2a2951e608 | ||
|
|
29382a4492 | ||
|
|
848b4d3aaa | ||
|
|
31ac05d8f4 | ||
|
|
8de6cde2d1 | ||
|
|
766398d86e | ||
|
|
d105eded16 | ||
|
|
59a7060088 | ||
|
|
1f8b022d17 | ||
|
|
1529d3fa34 | ||
|
|
c0b80724b4 | ||
|
|
fdf58188ca | ||
|
|
9a2c8d0ecb | ||
|
|
87d69530a0 | ||
|
|
b790fbd28f | ||
|
|
6abeaed4aa | ||
|
|
42c2fb1f5c | ||
|
|
ed44d9e0db | ||
|
|
2a1a11ca4b | ||
|
|
d6849a3d57 | ||
|
|
8478569b4b | ||
|
|
4e509ff160 | ||
|
|
a6fdf83073 | ||
|
|
4b4d84da0b | ||
|
|
ccf18cf8f9 | ||
|
|
b465c53afe | ||
|
|
bc9ae12596 | ||
|
|
6669a6590a | ||
|
|
85a648ccc6 | ||
|
|
bd0faf69c5 | ||
|
|
91e11cc095 | ||
|
|
12b7c5a6a5 | ||
|
|
acfb53c8d5 | ||
|
|
a707c5e0c7 | ||
|
|
c7cabf8fb2 | ||
|
|
f06b95526c | ||
|
|
7aab9a20d1 | ||
|
|
7535e03679 | ||
|
|
85db0634e5 | ||
|
|
2ec849d7b9 | ||
|
|
44288a186c | ||
|
|
de75c6a122 | ||
|
|
8c9f98f17e | ||
|
|
b2409bee14 | ||
|
|
3277479584 | ||
|
|
00bd5c9a22 | ||
|
|
cc8637f65c | ||
|
|
53f5e263a2 | ||
|
|
4310a05d67 | ||
|
|
65c8bfc655 | ||
|
|
a74e57bcd4 | ||
|
|
1dd4f6484d | ||
|
|
5a60afa475 | ||
|
|
9ee38bd681 | ||
|
|
8f89740308 | ||
|
|
c23b08245e | ||
|
|
d7240abb18 | ||
|
|
0757c89d7c | ||
|
|
fe6c23f26f | ||
|
|
56d1db8b45 | ||
|
|
8e856b00b4 | ||
|
|
046d415f98 | ||
|
|
7e9321e57c | ||
|
|
5aab13ca8d | ||
|
|
8f722ad0fc | ||
|
|
bfebe0aab4 | ||
|
|
bf614690ad | ||
|
|
d1b0c2221b | ||
|
|
c581a975ed |
No files matched your search
+173
@@ -0,0 +1,173 @@
|
||||
---
|
||||
# Project
|
||||
Standard: c++17
|
||||
ColumnLimit: 120
|
||||
|
||||
# Indentation
|
||||
AccessModifierOffset: -4
|
||||
BitFieldColonSpacing: Both
|
||||
ContinuationIndentWidth: 4
|
||||
IndentCaseLabels: true
|
||||
IndentCaseBlocks: false
|
||||
IndentExternBlock: Indent
|
||||
IndentPPDirectives: None
|
||||
IndentRequires: true
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: true
|
||||
TabWidth: 4
|
||||
UseTab: Never
|
||||
|
||||
# Alignment
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: Consecutive
|
||||
AlignConsecutiveBitFields: Consecutive
|
||||
AlignConsecutiveDeclarations: Consecutive
|
||||
AlignConsecutiveMacros: Consecutive
|
||||
AlignEscapedNewlines: Left
|
||||
AlignOperands: Align
|
||||
AlignTrailingComments: true
|
||||
|
||||
# Allow
|
||||
AllowAllArgumentsOnNextLine: false
|
||||
AllowAllConstructorInitializersOnNextLine: false
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortBlocksOnASingleLine: Never
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortEnumsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: None
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AllowShortLambdasOnASingleLine: All
|
||||
|
||||
# Break
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
AlwaysBreakTemplateDeclarations: Yes
|
||||
BreakBeforeConceptDeclarations: true
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializers: AfterColon
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakInheritanceList: AfterColon
|
||||
BreakStringLiterals: true
|
||||
|
||||
# Initializers & arguments
|
||||
BinPackArguments: false
|
||||
BinPackParameters: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
ConstructorInitializerIndentWidth: 0
|
||||
Cpp11BracedListStyle: true
|
||||
|
||||
# Braces
|
||||
BreakBeforeBraces: Custom
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: true
|
||||
AfterClass: true
|
||||
AfterControlStatement: Always
|
||||
AfterEnum: true
|
||||
AfterFunction: true
|
||||
AfterNamespace: true
|
||||
AfterStruct: true
|
||||
AfterUnion: true
|
||||
AfterExternBlock: true
|
||||
BeforeCatch: false
|
||||
BeforeElse: true
|
||||
BeforeLambdaBody: true
|
||||
BeforeWhile: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
|
||||
# Namespaces
|
||||
CompactNamespaces: false
|
||||
FixNamespaceComments: true
|
||||
NamespaceIndentation: None
|
||||
|
||||
# Derive
|
||||
DeriveLineEnding: false
|
||||
DerivePointerAlignment: false
|
||||
|
||||
# Empty lines
|
||||
EmptyLineBeforeAccessModifier: Always
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
MaxEmptyLinesToKeep: 2
|
||||
|
||||
# Sorting
|
||||
IncludeBlocks: Regroup
|
||||
IncludeCategories:
|
||||
- Priority: 1
|
||||
Regex: '^<CSFML\/Config.h>$'
|
||||
- Priority: 2
|
||||
Regex: '^<CSFML\/(.+)\/Export.h>$'
|
||||
- Priority: 3
|
||||
Regex: '^<CSFML\/'
|
||||
- Priority: 4
|
||||
Regex: '^<SFML\/'
|
||||
- Priority: 5
|
||||
Regex: '^<(catch2)'
|
||||
- Priority: 6
|
||||
Regex: '^<(.+)>$'
|
||||
SortIncludes: true
|
||||
SortUsingDeclarations: true
|
||||
|
||||
# Penalties
|
||||
PenaltyBreakAssignment: 1000
|
||||
PenaltyBreakBeforeFirstCallParameter: 1000
|
||||
PenaltyBreakComment: 200
|
||||
PenaltyBreakFirstLessLess: 100
|
||||
PenaltyBreakString: 1
|
||||
PenaltyBreakTemplateDeclaration: 0
|
||||
PenaltyExcessCharacter: 5
|
||||
PenaltyIndentedWhitespace: 1
|
||||
PenaltyReturnTypeOnItsOwnLine: 500
|
||||
|
||||
# Pointer alignment
|
||||
PointerAlignment: Left
|
||||
|
||||
# Comments
|
||||
ReflowComments: false
|
||||
|
||||
# Spaces
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceAroundPointerQualifiers: Default
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCaseColon: false
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceBeforeSquareBrackets: false
|
||||
SpaceInEmptyBlock: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInConditionalStatement: false
|
||||
SpacesInContainerLiterals: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
|
||||
# Line endings
|
||||
UseCRLF: false
|
||||
|
||||
# Qualifiers (const, volatile, static, etc)
|
||||
QualifierAlignment: Custom
|
||||
QualifierOrder: ['static', 'inline', 'constexpr', 'const', 'volatile', 'type']
|
||||
|
||||
---
|
||||
Language: ObjC
|
||||
IndentWidth: 4
|
||||
BreakBeforeBraces: Custom
|
||||
BraceWrapping:
|
||||
AfterObjCDeclaration: true
|
||||
|
||||
ObjCBinPackProtocolList: Never
|
||||
ObjCBlockIndentWidth: 4
|
||||
ObjCBreakBeforeNestedBlockParam: true
|
||||
ObjCSpaceAfterProperty: true
|
||||
ObjCSpaceBeforeProtocolList: false
|
||||
|
||||
...
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
Checks: >
|
||||
bugprone-*,
|
||||
clang-analyzer-*,
|
||||
cppcoreguidelines-*,
|
||||
modernize-*,
|
||||
readability-identifier-naming,
|
||||
-bugprone-easily-swappable-parameters,
|
||||
-bugprone-narrowing-conversions,
|
||||
-clang-analyzer-core.NonNullParamChecker,
|
||||
-clang-analyzer-security.insecureAPI.strcpy,
|
||||
-cppcoreguidelines-avoid-c-arrays,
|
||||
-cppcoreguidelines-avoid-magic-numbers,
|
||||
-cppcoreguidelines-avoid-non-const-global-variables,
|
||||
-cppcoreguidelines-macro-to-enum,
|
||||
-cppcoreguidelines-macro-usage,
|
||||
-cppcoreguidelines-narrowing-conversions,
|
||||
-cppcoreguidelines-no-malloc,
|
||||
-cppcoreguidelines-non-private-member-variables-in-classes,
|
||||
-cppcoreguidelines-owning-memory,
|
||||
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
|
||||
-cppcoreguidelines-pro-bounds-constant-array-index,
|
||||
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
|
||||
-cppcoreguidelines-pro-type-const-cast,
|
||||
-cppcoreguidelines-pro-type-reinterpret-cast,
|
||||
-cppcoreguidelines-special-member-functions,
|
||||
-modernize-avoid-c-arrays,
|
||||
-modernize-macro-to-enum,
|
||||
-modernize-redundant-void-arg,
|
||||
-modernize-use-trailing-return-type,
|
||||
-modernize-use-using,
|
||||
CheckOptions:
|
||||
- { key: readability-identifier-naming.VariableCase, value: camelBack }
|
||||
- { key: readability-identifier-naming.GlobalVariableCase, value: aNy_CasE }
|
||||
- { key: readability-identifier-naming.ParameterCase, value: camelBack }
|
||||
HeaderFilterRegex: '.*'
|
||||
WarningsAsErrors: '*'
|
||||
UseColor: true
|
||||
@@ -0,0 +1,2 @@
|
||||
github: SFML
|
||||
open_collective: sfml
|
||||
@@ -0,0 +1,162 @@
|
||||
name: CI
|
||||
|
||||
on: [push, pull_request, workflow_dispatch]
|
||||
|
||||
concurrency:
|
||||
group: environment-${{github.ref}}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
SFML_VERSION: 3.0.0
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: ${{ matrix.platform.name }} ${{ matrix.config.name }} ${{ matrix.type.name }}
|
||||
runs-on: ${{ matrix.platform.os }}
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform:
|
||||
- { name: Windows VS2019 x86, os: windows-2019, flags: -AWin32 }
|
||||
- { name: Windows VS2019 x64, os: windows-2019, flags: -Ax64 }
|
||||
- { name: Windows VS2022 x86, os: windows-2022, flags: -AWin32 }
|
||||
- { name: Windows VS2022 x64, os: windows-2022, flags: -Ax64 }
|
||||
- { name: Windows ClangCL, os: windows-2022, flags: -T ClangCL }
|
||||
- { name: Windows Clang, os: windows-2022, flags: -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ }
|
||||
- { name: Linux GCC, os: ubuntu-22.04, flags: -GNinja }
|
||||
- { name: Linux Clang, os: ubuntu-22.04, flags: -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ }
|
||||
- { name: MacOS, os: macos-14, flags: -GNinja }
|
||||
config:
|
||||
- { name: Shared, flags: -DBUILD_SHARED_LIBS=ON, csfml_flags: -DCSFML_LINK_SFML_STATICALLY=OFF }
|
||||
- { name: Static, flags: -DBUILD_SHARED_LIBS=OFF, csfml_flags: -DCSFML_LINK_SFML_STATICALLY=ON }
|
||||
type:
|
||||
- { name: Debug }
|
||||
- { name: Release }
|
||||
|
||||
steps:
|
||||
- name: Get CMake and Ninja
|
||||
uses: lukka/get-cmake@latest
|
||||
with:
|
||||
ninjaVersion: latest
|
||||
|
||||
- name: Install Linux Dependencies
|
||||
if: runner.os == 'Linux'
|
||||
run: sudo apt-get update && sudo apt-get install libxrandr-dev libxcursor-dev libxi-dev libudev-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev
|
||||
|
||||
- name: Checkout SFML
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: SFML/SFML
|
||||
ref: ${{env.SFML_VERSION}}
|
||||
path: SFML
|
||||
|
||||
- name: Configure SFML CMake
|
||||
run: cmake -S SFML -B SFML/build -DCMAKE_INSTALL_PREFIX=SFML/install ${{matrix.platform.flags}} ${{matrix.config.flags}} -DCMAKE_BUILD_TYPE=${{matrix.type.name}}
|
||||
|
||||
- name: Build SFML
|
||||
run: cmake --build SFML/build --config ${{matrix.type.name}} --target install
|
||||
|
||||
- name: Checkout CSFML
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: CSFML
|
||||
|
||||
- name: Configure CSFML CMake
|
||||
run: cmake --preset dev -S CSFML -B CSFML/build -DCMAKE_INSTALL_PREFIX=CSFML/install -DSFML_ROOT=SFML/install -DCMAKE_VERBOSE_MAKEFILE=ON ${{matrix.platform.flags}} ${{matrix.config.flags}} ${{matrix.config.csfml_flags}} -DCMAKE_BUILD_TYPE=${{matrix.type.name}}
|
||||
|
||||
- name: Build CSFML
|
||||
run: cmake --build CSFML/build --config ${{matrix.type.name}} --target install
|
||||
|
||||
- name: Test
|
||||
run: ctest --test-dir CSFML/build -C ${{matrix.type.name}} --output-on-failure
|
||||
|
||||
format:
|
||||
name: Formatting
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
steps:
|
||||
- name: Install Clang Format
|
||||
run: sudo apt-get install clang-format-17
|
||||
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Format Code
|
||||
run: cmake -DCLANG_FORMAT_EXECUTABLE=clang-format-17 -P cmake/Format.cmake
|
||||
|
||||
- name: Check Formatting
|
||||
run: git diff --exit-code
|
||||
|
||||
tidy:
|
||||
name: Analyze
|
||||
runs-on: macos-14
|
||||
|
||||
steps:
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
brew update
|
||||
brew install llvm ninja
|
||||
echo /opt/homebrew/opt/llvm/bin >> $GITHUB_PATH
|
||||
|
||||
- name: Checkout SFML
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: SFML/SFML
|
||||
ref: ${{env.SFML_VERSION}}
|
||||
path: SFML
|
||||
|
||||
- name: Configure SFML CMake
|
||||
run: cmake -S SFML -B SFML/build -GNinja -DCMAKE_INSTALL_PREFIX=SFML/install -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Debug
|
||||
|
||||
- name: Build SFML
|
||||
run: cmake --build SFML/build --target install
|
||||
|
||||
- name: Checkout CSFML
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: CSFML
|
||||
|
||||
- name: Configure CSFML CMake
|
||||
run: cmake --preset dev -S CSFML -B CSFML/build -DSFML_ROOT=SFML/install -DCMAKE_BUILD_TYPE=Debug
|
||||
|
||||
- name: Tidy
|
||||
run: cmake --build CSFML/build --target tidy
|
||||
|
||||
docs:
|
||||
name: Documentation
|
||||
runs-on: macos-14
|
||||
|
||||
steps:
|
||||
- name: Install Doxygen
|
||||
run: |
|
||||
brew update
|
||||
brew install doxygen ninja || true
|
||||
|
||||
- name: Checkout SFML
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: SFML/SFML
|
||||
ref: ${{env.SFML_VERSION}}
|
||||
path: SFML
|
||||
|
||||
- name: Configure SFML
|
||||
run: cmake -S SFML -B SFML/build -GNinja -DCMAKE_INSTALL_PREFIX=SFML/install
|
||||
|
||||
- name: Build SFML
|
||||
run: cmake --build SFML/build --target install
|
||||
|
||||
- name: Checkout CSFML
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: CSFML
|
||||
|
||||
- name: Configure CSFML
|
||||
run: cmake -S CSFML -B CSFML/build -GNinja -DSFML_ROOT=SFML/install -DCSFML_BUILD_DOC=ON -DCSFML_LINK_SFML_STATICALLY=ON
|
||||
|
||||
- name: Build Doxygen Site
|
||||
run: cmake --build CSFML/build --target doc
|
||||
@@ -0,0 +1,252 @@
|
||||
name: NuGet Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- 2.6.x
|
||||
workflow_dispatch: {}
|
||||
|
||||
concurrency:
|
||||
group: nuget-${{github.ref}}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
DOTNET_CLI_TELEMETRY_OPTOUT: 1
|
||||
|
||||
jobs:
|
||||
windows:
|
||||
name: Windows VS2022
|
||||
runs-on: windows-2022
|
||||
|
||||
steps:
|
||||
- name: Checkout CSFML
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: CSFML
|
||||
|
||||
- name: Build x86
|
||||
shell: pwsh
|
||||
run: |
|
||||
cd CSFML/tools/nuget
|
||||
./build.win.ps1 "win-x86"
|
||||
|
||||
- name: Build x64
|
||||
shell: pwsh
|
||||
run: |
|
||||
cd CSFML/tools/nuget
|
||||
./build.win.ps1 "win-x64"
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: CSFML-win-x86-x64
|
||||
path: CSFML/tools/nuget/CSFML/runtimes
|
||||
|
||||
linux-x64:
|
||||
name: Linux x64
|
||||
runs-on: ubuntu-22.04
|
||||
container:
|
||||
image: ubuntu:22.04
|
||||
|
||||
steps:
|
||||
- name: Checkout CSFML
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: CSFML
|
||||
|
||||
- name: Build
|
||||
shell: bash
|
||||
run: |
|
||||
cd ./CSFML/tools/nuget
|
||||
chmod +x ./docker.linux-x64.sh
|
||||
./docker.linux-x64.sh
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: CSFML-linux-x64
|
||||
path: CSFML/tools/nuget/CSFML/runtimes
|
||||
|
||||
linux-arm:
|
||||
name: Linux ARM
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: Checkout CSFML
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: CSFML
|
||||
|
||||
- name: Build in an ARM container
|
||||
uses: uraimo/run-on-arch-action@v2.7.2
|
||||
with:
|
||||
arch: armv7
|
||||
distro: ubuntu22.04
|
||||
githubToken: ${{ github.token }}
|
||||
dockerRunArgs: |
|
||||
--volume "${PWD}/CSFML:/CSFML"
|
||||
install: |
|
||||
apt-get update -y
|
||||
apt-get install -y git libfreetype6-dev xorg-dev libxrandr-dev libxcursor-dev libxi-dev libudev-dev libgl1-mesa-dev libflac-dev libogg-dev libvorbis-dev cmake g++
|
||||
run: |
|
||||
cd /CSFML/tools/nuget
|
||||
chmod +x ./build.linux.sh
|
||||
./build.linux.sh linux-arm
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: CSFML-linux-arm
|
||||
path: CSFML/tools/nuget/CSFML/runtimes
|
||||
|
||||
linux-arm64:
|
||||
name: Linux ARM64
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: Checkout CSFML
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: CSFML
|
||||
|
||||
- name: Build in an ARM64 container
|
||||
uses: uraimo/run-on-arch-action@v2.7.2
|
||||
with:
|
||||
arch: aarch64
|
||||
distro: ubuntu22.04
|
||||
githubToken: ${{ github.token }}
|
||||
dockerRunArgs: |
|
||||
--volume "${PWD}/CSFML:/CSFML"
|
||||
install: |
|
||||
apt-get update -y
|
||||
apt-get install -y git libfreetype6-dev xorg-dev libxrandr-dev libxcursor-dev libudev-dev libgl1-mesa-dev libflac-dev libogg-dev libvorbis-dev cmake g++
|
||||
run: |
|
||||
cd /CSFML/tools/nuget
|
||||
chmod +x ./build.linux.sh
|
||||
./build.linux.sh linux-arm64
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: CSFML-linux-arm64
|
||||
path: CSFML/tools/nuget/CSFML/runtimes
|
||||
|
||||
linux-musl-x64:
|
||||
name: Linux MUSL x64
|
||||
runs-on: ubuntu-22.04
|
||||
container:
|
||||
image: alpine:3.20.3
|
||||
|
||||
steps:
|
||||
- name: Checkout CSFML
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: CSFML
|
||||
|
||||
- name: Build
|
||||
shell: sh
|
||||
run: |
|
||||
cd ./CSFML/tools/nuget
|
||||
chmod +x ./docker.linux-musl-x64.sh
|
||||
./docker.linux-musl-x64.sh
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: CSFML-linux-musl-x64
|
||||
path: CSFML/tools/nuget/CSFML/runtimes
|
||||
|
||||
fedora-x64:
|
||||
name: Fedora x64
|
||||
runs-on: ubuntu-22.04
|
||||
container:
|
||||
image: fedora:37
|
||||
|
||||
steps:
|
||||
- name: Checkout CSFML
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: CSFML
|
||||
|
||||
- name: Build
|
||||
shell: bash
|
||||
run: |
|
||||
cd ./CSFML/tools/nuget
|
||||
chmod +x ./docker.fedora-x64.sh
|
||||
./docker.fedora-x64.sh
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: CSFML-fedora-x64
|
||||
path: CSFML/tools/nuget/CSFML/runtimes
|
||||
|
||||
macos:
|
||||
name: macOS
|
||||
runs-on: macos-14
|
||||
|
||||
steps:
|
||||
- name: Checkout CSFML
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: CSFML
|
||||
|
||||
- name: Install necessary tooling
|
||||
run: brew install coreutils
|
||||
|
||||
- name: Build x64
|
||||
run: |
|
||||
cd CSFML/tools/nuget
|
||||
./build.macos.sh "osx-x64"
|
||||
|
||||
- name: Build ARM64
|
||||
run: |
|
||||
cd CSFML/tools/nuget
|
||||
./build.macos.sh "osx-arm64"
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: CSFML-macOS-x64-arm64
|
||||
path: CSFML/tools/nuget/CSFML/runtimes
|
||||
|
||||
package:
|
||||
name: Package Builds
|
||||
runs-on: ubuntu-22.04
|
||||
needs:
|
||||
- windows
|
||||
- linux-x64
|
||||
- linux-arm
|
||||
- linux-arm64
|
||||
- linux-musl-x64
|
||||
- fedora-x64
|
||||
- macos
|
||||
steps:
|
||||
- name: Checkout CSFML
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: CSFML
|
||||
- name: Download Artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: CSFML/tools/nuget/CSFML/runtimes
|
||||
merge-multiple: true
|
||||
- name: Setup .NET 8 SDK
|
||||
id: setup-dotnet
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
- name: Enforce SDK Version
|
||||
run: dotnet new globaljson --sdk-version ${{ steps.setup-dotnet.outputs.dotnet-version }} --force
|
||||
- name: Verify SDK Installation
|
||||
run: dotnet --info
|
||||
- name: Build NuGet Package
|
||||
run: |
|
||||
cd CSFML/tools/nuget
|
||||
dotnet build --configuration Release --verbosity detailed
|
||||
- name: Upload NuGet Package
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: CSFML-NuGet-Package
|
||||
path: CSFML/tools/nuget/CSFML/bin/Release/*.nupkg
|
||||
@@ -0,0 +1,7 @@
|
||||
.cache/
|
||||
.idea/
|
||||
.vs/
|
||||
.vscode/
|
||||
build/
|
||||
cmake-build-*/
|
||||
CMakeUserPresets.json
|
||||
+110
-38
@@ -1,60 +1,132 @@
|
||||
cmake_minimum_required(VERSION 3.22)
|
||||
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
# define a macro that helps defining an option
|
||||
macro(csfml_set_option var default type docstring)
|
||||
if(NOT DEFINED ${var})
|
||||
set(${var} ${default})
|
||||
endif()
|
||||
set(${var} ${${var}} CACHE ${type} ${docstring} FORCE)
|
||||
endmacro()
|
||||
|
||||
# set a default build type if none was provided
|
||||
# this has to be done before the project() instruction!
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build (Debug or Release)" FORCE)
|
||||
endif()
|
||||
csfml_set_option(CMAKE_BUILD_TYPE Release STRING "Choose the type of build (Debug or Release)")
|
||||
|
||||
# project name
|
||||
project(CSFML)
|
||||
project(CSFML VERSION 3.0.0)
|
||||
|
||||
# we use the paths from the cmake GNUInstallDirs module as defaults
|
||||
# you can override these if you like
|
||||
# https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# include the configuration file
|
||||
include(${CMAKE_SOURCE_DIR}/cmake/Config.cmake)
|
||||
include(${PROJECT_SOURCE_DIR}/cmake/Config.cmake)
|
||||
|
||||
# setup version numbers
|
||||
set(VERSION_MAJOR 2)
|
||||
set(VERSION_MINOR 0)
|
||||
set(VERSION_PATCH 0)
|
||||
# add options to select which modules to build
|
||||
csfml_set_option(CSFML_BUILD_WINDOW ON BOOL "ON to build CSFML's Window module. This setting is ignored, if the graphics module is built.")
|
||||
csfml_set_option(CSFML_BUILD_GRAPHICS ON BOOL "ON to build CSFML's Graphics module.")
|
||||
csfml_set_option(CSFML_BUILD_AUDIO ON BOOL "ON to build CSFML's Audio module.")
|
||||
csfml_set_option(CSFML_BUILD_NETWORK ON BOOL "ON to build CSFML's Network module.")
|
||||
|
||||
# add the CSFML header path
|
||||
include_directories(${CMAKE_SOURCE_DIR}/include)
|
||||
|
||||
# force dynamic build (static build is not supported)
|
||||
set(BUILD_SHARED_LIBS TRUE)
|
||||
# add an option for choosing the build type (shared or static)
|
||||
csfml_set_option(BUILD_SHARED_LIBS ON BOOL "ON to build CSFML as shared libraries, OFF to build it as static libraries")
|
||||
|
||||
# add an option for building the API documentation
|
||||
set(BUILD_DOC FALSE CACHE BOOL "TRUE to generate the API documentation, FALSE to ignore it")
|
||||
csfml_set_option(CSFML_BUILD_DOC OFF BOOL "ON to generate the API documentation, OFF to ignore it")
|
||||
|
||||
# disable the rpath stuff
|
||||
set(CMAKE_SKIP_BUILD_RPATH TRUE)
|
||||
# add an option for linking to sfml either statically or dynamically
|
||||
# default on windows to static and on other platforms to dynamic
|
||||
if(SFML_OS_WINDOWS)
|
||||
set(LINK_STATICALLY_DEFAULT ON)
|
||||
else()
|
||||
set(LINK_STATICALLY_DEFAULT OFF)
|
||||
endif()
|
||||
csfml_set_option(CSFML_LINK_SFML_STATICALLY ${LINK_STATICALLY_DEFAULT} BOOL "ON to link to a static version of SFML, OFF to link dynamically")
|
||||
|
||||
# define an option for choosing between static and dynamic C runtime (Windows only)
|
||||
if(WINDOWS)
|
||||
set(STATIC_STD_LIBS FALSE CACHE BOOL "TRUE to statically link to the standard libraries, FALSE to use them as DLLs")
|
||||
|
||||
# for VC++, we can apply it globally by modifying the compiler flags
|
||||
if(COMPILER_MSVC AND STATIC_STD_LIBS)
|
||||
foreach(flag
|
||||
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
||||
if(${flag} MATCHES "/MD")
|
||||
string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
if(SFML_OS_WINDOWS)
|
||||
csfml_set_option(CSFML_USE_STATIC_STD_LIBS OFF BOOL "ON to statically link to the standard libraries, OFF to use them as DLLs")
|
||||
endif()
|
||||
|
||||
# find SFML libraries (C++)
|
||||
if(CSFML_LINK_SFML_STATICALLY)
|
||||
set(SFML_STATIC_LIBRARIES ON)
|
||||
endif()
|
||||
set(SFML_MODULES "System")
|
||||
if(CSFML_BUILD_AUDIO)
|
||||
list(PREPEND SFML_MODULES "Audio")
|
||||
endif()
|
||||
if(CSFML_BUILD_GRAPHICS)
|
||||
list(PREPEND SFML_MODULES "Graphics")
|
||||
endif()
|
||||
if(CSFML_BUILD_WINDOW)
|
||||
list(PREPEND SFML_MODULES "Window")
|
||||
endif()
|
||||
if(CSFML_BUILD_NETWORK)
|
||||
list(PREPEND SFML_MODULES "Network")
|
||||
endif()
|
||||
find_package(SFML 3.0.0 COMPONENTS ${SFML_MODULES} REQUIRED)
|
||||
|
||||
# add the subdirectories
|
||||
add_subdirectory(src/SFML)
|
||||
if(BUILD_DOC)
|
||||
add_subdirectory(src/CSFML)
|
||||
if(CSFML_BUILD_DOC)
|
||||
add_subdirectory(doc)
|
||||
endif()
|
||||
|
||||
# on Linux and BSD-like OS, install pkg-config files by default
|
||||
set(CSFML_INSTALL_PKGCONFIG_DEFAULT OFF)
|
||||
|
||||
if(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_OPENBSD OR SFML_OS_NETBSD)
|
||||
set(CSFML_INSTALL_PKGCONFIG_DEFAULT ON)
|
||||
endif()
|
||||
|
||||
csfml_set_option(CSFML_INSTALL_PKGCONFIG_FILES ${CSFML_INSTALL_PKGCONFIG_DEFAULT} BOOL "ON to automatically install pkg-config files so other projects can find SFML")
|
||||
|
||||
if(CSFML_INSTALL_PKGCONFIG_FILES)
|
||||
csfml_set_option(CSFML_PKGCONFIG_INSTALL_DIR "${CSFML_PKGCONFIG_DIR}" PATH "Install directory for CSFML's pkg-config .pc files")
|
||||
|
||||
foreach(csfml_module IN ITEMS all system window graphics audio network)
|
||||
configure_file(
|
||||
"tools/pkg-config/csfml-${csfml_module}.pc.in"
|
||||
"tools/pkg-config/csfml-${csfml_module}.pc"
|
||||
@ONLY)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tools/pkg-config/csfml-${csfml_module}.pc"
|
||||
DESTINATION "${CSFML_PKGCONFIG_INSTALL_DIR}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# setup the install rules
|
||||
install(DIRECTORY include
|
||||
DESTINATION .
|
||||
COMPONENT devel
|
||||
PATTERN ".svn" EXCLUDE)
|
||||
install(FILES license.txt DESTINATION ${INSTALL_MISC_DIR})
|
||||
install(DIRECTORY include/
|
||||
DESTINATION include
|
||||
COMPONENT devel)
|
||||
install(FILES license.md DESTINATION ${INSTALL_MISC_DIR})
|
||||
install(FILES readme.md DESTINATION ${INSTALL_MISC_DIR})
|
||||
|
||||
# stop configuration if consuming CSFML as a subdirectory
|
||||
if(NOT PROJECT_IS_TOP_LEVEL)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# add an option for building the examples
|
||||
csfml_set_option(CSFML_BUILD_EXAMPLES OFF BOOL "ON to build the CSFML examples, OFF to ignore them")
|
||||
if(CSFML_BUILD_EXAMPLES)
|
||||
add_subdirectory(examples)
|
||||
endif()
|
||||
|
||||
# add an option for building the tests
|
||||
csfml_set_option(CSFML_BUILD_TEST_SUITE OFF BOOL "ON to build the CSFML test suite, OFF to ignore it")
|
||||
if(CSFML_BUILD_TEST_SUITE)
|
||||
enable_testing()
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
||||
csfml_set_option(CLANG_FORMAT_EXECUTABLE clang-format STRING "Override clang-format executable, requires version 17")
|
||||
add_custom_target(format
|
||||
COMMAND ${CMAKE_COMMAND} -DCLANG_FORMAT_EXECUTABLE=${CLANG_FORMAT_EXECUTABLE} -P ./cmake/Format.cmake
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} VERBATIM)
|
||||
|
||||
csfml_set_option(CLANG_TIDY_EXECUTABLE clang-tidy STRING "Override clang-tidy executable, requires minimum version 14")
|
||||
add_custom_target(tidy
|
||||
COMMAND ${CMAKE_COMMAND} -DCLANG_TIDY_EXECUTABLE=${CLANG_TIDY_EXECUTABLE} -DPROJECT_BINARY_DIR=${PROJECT_BINARY_DIR} -P ./cmake/Tidy.cmake
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} VERBATIM)
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"version": 3,
|
||||
"configurePresets":[
|
||||
{
|
||||
"name": "dev",
|
||||
"binaryDir": "build",
|
||||
"installDir": "${sourceDir}/build/install",
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_EXTENSIONS": "OFF",
|
||||
"CMAKE_CXX_EXTENSIONS": "OFF",
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
|
||||
"CMAKE_RUNTIME_OUTPUT_DIRECTORY": "${sourceDir}/build/bin",
|
||||
"CSFML_BUILD_EXAMPLES": "ON",
|
||||
"CSFML_BUILD_TEST_SUITE": "ON",
|
||||
"CSFML_WARNINGS_AS_ERRORS": "ON"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
# from here:
|
||||
#
|
||||
# https://github.com/lefticus/cppbestpractices/blob/master/02-Use_the_Tools_Available.md
|
||||
|
||||
# Helper function to enable compiler warnings for a specific target
|
||||
function(set_target_warnings target)
|
||||
option(CSFML_WARNINGS_AS_ERRORS "Treat compiler warnings as errors" OFF)
|
||||
|
||||
set(MSVC_WARNINGS
|
||||
/W4 # Baseline reasonable warnings
|
||||
/w14242 # 'identifier': conversion from 'type1' to 'type1', possible loss of data
|
||||
/w14254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
|
||||
/w14263 # 'function': member function does not override any base class virtual member function
|
||||
/w14265 # 'classname': class has virtual functions, but destructor is not virtual instances of this class may not be destructed correctly
|
||||
/w14287 # 'operator': unsigned/negative constant mismatch
|
||||
/we4289 # nonstandard extension used: 'variable': loop control variable declared in the for-loop is used outside the for-loop scope
|
||||
/w14296 # 'operator': expression is always 'boolean_value'
|
||||
/w14311 # 'variable': pointer truncation from 'type1' to 'type2'
|
||||
/w14545 # expression before comma evaluates to a function which is missing an argument list
|
||||
/w14546 # function call before comma missing argument list
|
||||
/w14547 # 'operator': operator before comma has no effect; expected operator with side-effect
|
||||
/w14549 # 'operator': operator before comma has no effect; did you intend 'operator'?
|
||||
/w14555 # expression has no effect; expected expression with side- effect
|
||||
/w14619 # pragma warning: there is no warning number 'number'
|
||||
/w14640 # Enable warning on thread un-safe static member initialization
|
||||
/w14826 # Conversion from 'type1' to 'type_2' is sign-extended. This may cause unexpected runtime behavior.
|
||||
/w14905 # wide string literal cast to 'LPSTR'
|
||||
/w14906 # string literal cast to 'LPWSTR'
|
||||
/w14928 # illegal copy-initialization; more than one user-defined conversion has been implicitly applied
|
||||
/permissive- # standards conformance mode for MSVC compiler
|
||||
|
||||
# Disables, remove when appropriate
|
||||
/wd4996 # disable warnings about deprecated functions
|
||||
/wd5105 # disable warning about expansion of 'defined' keyword
|
||||
)
|
||||
|
||||
set(CLANG_AND_GCC_WARNINGS
|
||||
-Wall
|
||||
-Wextra # reasonable and standard
|
||||
$<$<COMPILE_LANGUAGE:CXX>:-Wnon-virtual-dtor> # warn the user if a class with virtual functions has a non-virtual destructor. This helps catch hard to track down memory errors
|
||||
-Wcast-align # warn for potential performance problem casts
|
||||
-Wunused # warn on anything being unused
|
||||
$<$<COMPILE_LANGUAGE:CXX>:-Woverloaded-virtual> # warn if you overload (not override) a virtual function
|
||||
-Wconversion # warn on type conversions that may lose data
|
||||
-Wsign-conversion # warn on sign conversions
|
||||
-Wdouble-promotion # warn if float is implicit promoted to double
|
||||
-Wformat=2 # warn on security issues around functions that format output (ie printf)
|
||||
# -Wimplicit-fallthrough # warn when a missing break causes control flow to continue at the next case in a switch statement (disabled until better compiler support for explicit fallthrough is available)
|
||||
-Wnull-dereference # warn if a null dereference is detected
|
||||
$<$<COMPILE_LANGUAGE:CXX>:-Wold-style-cast> # warn for c-style casts
|
||||
-Wpedantic # warn if non-standard C++ is used
|
||||
-Wno-deprecated-declarations # do not warning about deprecated declarations
|
||||
-Wno-language-extension-token # ignore use of __int64 compiler extension
|
||||
)
|
||||
|
||||
# Disable warnings as errors when using Clang on Windows to work around deprecation warnings in Windows APIs
|
||||
if(SFML_OS_WINDOWS AND (SFML_COMPILER_CLANG OR SFML_COMPILER_CLANG_CL))
|
||||
set(CSFML_WARNINGS_AS_ERRORS OFF)
|
||||
endif()
|
||||
|
||||
if(CSFML_WARNINGS_AS_ERRORS)
|
||||
list(APPEND CLANG_AND_GCC_WARNINGS -Werror)
|
||||
list(APPEND MSVC_WARNINGS /WX)
|
||||
endif()
|
||||
|
||||
set(CLANG_WARNINGS
|
||||
${CLANG_AND_GCC_WARNINGS}
|
||||
-Wno-unknown-warning-option # do not warn on GCC-specific warning diagnostic pragmas
|
||||
)
|
||||
|
||||
set(GCC_WARNINGS
|
||||
${CLANG_AND_GCC_WARNINGS}
|
||||
-Wmisleading-indentation # warn if indentation implies blocks where blocks do not exist
|
||||
-Wduplicated-cond # warn if if / else chain has duplicated conditions
|
||||
-Wlogical-op # warn about logical operations being used where bitwise were probably wanted
|
||||
# -Wuseless-cast # warn if you perform a cast to the same type (disabled because it is not portable as some typedefs might vary between platforms)
|
||||
)
|
||||
|
||||
# Don't enable -Wduplicated-branches for GCC < 8.1 since it will lead to false positives
|
||||
# https://github.com/gcc-mirror/gcc/commit/6bebae75035889a4844eb4d32a695bebf412bcd7
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1)
|
||||
list(APPEND GCC_WARNINGS
|
||||
-Wduplicated-branches # warn if if / else branches have duplicated code
|
||||
)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
set(FILE_WARNINGS ${MSVC_WARNINGS})
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
|
||||
set(FILE_WARNINGS ${CLANG_WARNINGS})
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set(FILE_WARNINGS ${GCC_WARNINGS})
|
||||
else()
|
||||
message(AUTHOR_WARNING "No compiler warnings set for '${CMAKE_CXX_COMPILER_ID}' compiler.")
|
||||
endif()
|
||||
|
||||
target_compile_options(${target} PRIVATE ${FILE_WARNINGS})
|
||||
endfunction()
|
||||
+30
-51
@@ -1,71 +1,50 @@
|
||||
|
||||
# detect the OS
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||
set(WINDOWS 1)
|
||||
|
||||
# detect the architecture (note: this test won't work for cross-compilation)
|
||||
include(CheckTypeSize)
|
||||
check_type_size(void* SIZEOF_VOID_PTR)
|
||||
if(${SIZEOF_VOID_PTR} EQUAL "4")
|
||||
set(ARCH_32BITS 1)
|
||||
elseif(${SIZEOF_VOID_PTR} EQUAL "8")
|
||||
set(ARCH_64BITS 1)
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported architecture")
|
||||
return()
|
||||
endif()
|
||||
set(SFML_OS_WINDOWS 1)
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
set(LINUX 1)
|
||||
set(SFML_OS_LINUX 1)
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||
# FreeBSD compile path is the same as Linux
|
||||
set(LINUX 1)
|
||||
set(SFML_OS_FREEBSD 1)
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
set(MACOSX 1)
|
||||
|
||||
# detect OS X version. (use '/usr/bin/sw_vers -productVersion' to extract V from '10.V.x'.)
|
||||
EXEC_PROGRAM(/usr/bin/sw_vers ARGS -productVersion OUTPUT_VARIABLE MACOSX_VERSION_RAW)
|
||||
STRING(REGEX REPLACE "10\\.([0-9]).*" "\\1" MACOSX_VERSION "${MACOSX_VERSION_RAW}")
|
||||
if(${MACOSX_VERSION} LESS 5)
|
||||
message(FATAL_ERROR "Unsupported version of OS X : ${MACOSX_VERSION_RAW}")
|
||||
return()
|
||||
endif()
|
||||
set(SFML_OS_MACOSX 1)
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported operating system")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# set pkgconfig install directory
|
||||
# this could be e.g. macports on mac or msys2 on windows etc.
|
||||
set(CSFML_PKGCONFIG_DIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||
|
||||
if(SFML_OS_FREEBSD OR SFML_OS_OPENBSD OR SFML_OS_NETBSD)
|
||||
set(CSFML_PKGCONFIG_DIR "libdata/pkgconfig")
|
||||
endif()
|
||||
|
||||
# detect the compiler and its version
|
||||
# Note: on some platforms (OS X), CMAKE_COMPILER_IS_GNUCXX is true
|
||||
# even when CLANG is used, therefore the Clang test is done first
|
||||
if(CMAKE_CXX_COMPILER MATCHES ".*clang[+][+]" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
# CMAKE_CXX_COMPILER_ID is an internal CMake variable subject to change,
|
||||
# but there is no other way to detect CLang at the moment
|
||||
set(COMPILER_CLANG 1)
|
||||
execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "--version" OUTPUT_VARIABLE CLANG_VERSION_OUTPUT)
|
||||
string(REGEX REPLACE ".*clang version ([0-9]+\\.[0-9]+).*" "\\1" CLANG_VERSION "${CLANG_VERSION_OUTPUT}")
|
||||
elseif(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(COMPILER_GCC 1)
|
||||
execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "-dumpversion" OUTPUT_VARIABLE GCC_VERSION_OUTPUT)
|
||||
string(REGEX REPLACE "([0-9]+\\.[0-9]+).*" "\\1" GCC_VERSION "${GCC_VERSION_OUTPUT}")
|
||||
elseif(MSVC)
|
||||
set(COMPILER_MSVC 1)
|
||||
if(MSVC_VERSION EQUAL 1400)
|
||||
set(MSVC_VERSION 2005)
|
||||
elseif(MSVC_VERSION EQUAL 1500)
|
||||
set(MSVC_VERSION 2008)
|
||||
elseif(MSVC_VERSION EQUAL 1600)
|
||||
set(MSVC_VERSION 2010)
|
||||
elseif(MSVC_VERSION EQUAL 1700)
|
||||
set(MSVC_VERSION 2011)
|
||||
# Note: The detection is order is important because:
|
||||
# - Visual Studio can both use MSVC and Clang
|
||||
# - GNUCXX can still be set on macOS when using Clang
|
||||
if(MSVC)
|
||||
set(SFML_COMPILER_MSVC 1)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(SFML_COMPILER_CLANG_CL 1)
|
||||
endif()
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(SFML_COMPILER_CLANG 1)
|
||||
elseif(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(SFML_COMPILER_GCC 1)
|
||||
|
||||
execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "--version" OUTPUT_VARIABLE GCC_COMPILER_VERSION)
|
||||
string(REGEX MATCHALL ".*(tdm[64]*-[1-9]).*" SFML_COMPILER_GCC_TDM "${GCC_COMPILER_VERSION}")
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported compiler")
|
||||
message(WARNING "Unsupported compiler")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# define the install directory for miscellaneous files
|
||||
if(WINDOWS)
|
||||
if(SFML_OS_WINDOWS)
|
||||
set(INSTALL_MISC_DIR .)
|
||||
elseif(UNIX)
|
||||
elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_MACOSX)
|
||||
set(INSTALL_MISC_DIR share/CSFML)
|
||||
endif()
|
||||
@@ -0,0 +1,27 @@
|
||||
# Check executable exists
|
||||
if(NOT EXISTS ${CLANG_FORMAT_EXECUTABLE})
|
||||
find_program(CLANG_FORMAT_EXEC_TEMP ${CLANG_FORMAT_EXECUTABLE})
|
||||
if(CLANG_FORMAT_EXEC_TEMP)
|
||||
set(CLANG_FORMAT_EXECUTABLE ${CLANG_FORMAT_EXEC_TEMP})
|
||||
unset(CLANG_FORMAT_EXEC_TEMP)
|
||||
else()
|
||||
message(FATAL_ERROR "Unable to find clang-format executable: \"${CLANG_FORMAT_EXECUTABLE}\"")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Check executable version
|
||||
execute_process(COMMAND ${CLANG_FORMAT_EXECUTABLE} --version OUTPUT_VARIABLE CLANG_FORMAT_VERSION)
|
||||
string(REGEX MATCH "clang-format version ([0-9]+)" CLANG_FORMAT_VERSION ${CLANG_FORMAT_VERSION})
|
||||
unset(CLANG_FORMAT_VERSION)
|
||||
if(NOT CMAKE_MATCH_1 EQUAL 17)
|
||||
message(FATAL_ERROR "clang-format version ${CMAKE_MATCH_1} not supported. Must use version 17")
|
||||
endif()
|
||||
|
||||
# Run
|
||||
set(SOURCES "")
|
||||
foreach(FOLDER IN ITEMS examples include src test)
|
||||
file(GLOB_RECURSE folder_files "${FOLDER}/*.h" "${FOLDER}/*.hpp" "${FOLDER}/*.c" "${FOLDER}/*.cpp")
|
||||
list(APPEND SOURCES ${folder_files})
|
||||
endforeach()
|
||||
|
||||
execute_process(COMMAND ${CLANG_FORMAT_EXECUTABLE} -i ${SOURCES})
|
||||
+60
-73
@@ -1,49 +1,5 @@
|
||||
|
||||
# some of these macros are inspired from the boost/cmake macros
|
||||
|
||||
# check if a value is contained in a list
|
||||
# sets ${var} to TRUE if the value is found
|
||||
macro(csfml_list_contains var value)
|
||||
set(${var})
|
||||
foreach(value2 ${ARGN})
|
||||
if(${value} STREQUAL ${value2})
|
||||
set(${var} TRUE)
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# parse a list of arguments and options
|
||||
# ex: sfml_parse_arguments(THIS "SOURCES;DEPENDS" "FLAG" FLAG SOURCES s1 s2 s3 DEPENDS d1 d2)
|
||||
# will define the following variables:
|
||||
# - THIS_SOURCES (s1 s2 s3)
|
||||
# - THIS_DEPENDS (d1 d2)
|
||||
# - THIS_FLAG TRUE
|
||||
macro(csfml_parse_arguments prefix arg_names option_names)
|
||||
foreach(arg_name ${arg_names})
|
||||
set(${prefix}_${arg_name})
|
||||
endforeach()
|
||||
foreach(option_name ${option_names})
|
||||
set(${prefix}_${option_name} FALSE)
|
||||
endforeach()
|
||||
set(current_arg_name)
|
||||
set(current_arg_list)
|
||||
foreach(arg ${ARGN})
|
||||
csfml_list_contains(is_arg_name ${arg} ${arg_names})
|
||||
if(is_arg_name)
|
||||
set(${prefix}_${current_arg_name} ${current_arg_list})
|
||||
set(current_arg_name ${arg})
|
||||
set(current_arg_list)
|
||||
else()
|
||||
csfml_list_contains(is_option ${arg} ${option_names})
|
||||
if(is_option)
|
||||
set(${prefix}_${arg} TRUE)
|
||||
else()
|
||||
set(current_arg_list ${current_arg_list} ${arg})
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
set(${prefix}_${current_arg_name} ${current_arg_list})
|
||||
endmacro()
|
||||
include(CMakeParseArguments)
|
||||
include(${PROJECT_SOURCE_DIR}/cmake/CompilerWarnings.cmake)
|
||||
|
||||
# add a new target which is a CSFML library
|
||||
# ex: csfml_add_library(csfml-graphics
|
||||
@@ -52,55 +8,86 @@ endmacro()
|
||||
macro(csfml_add_library target)
|
||||
|
||||
# parse the arguments
|
||||
csfml_parse_arguments(THIS "SOURCES;DEPENDS" "" ${ARGN})
|
||||
cmake_parse_arguments(THIS "" "" "SOURCES;DEPENDS;EXTERNAL_LIBS" ${ARGN})
|
||||
|
||||
# create the target
|
||||
add_library(${target} ${THIS_SOURCES})
|
||||
|
||||
# add the CSFML header path
|
||||
target_include_directories(${target} PUBLIC ${PROJECT_SOURCE_DIR}/include)
|
||||
|
||||
# add warnings
|
||||
set_target_warnings(${target})
|
||||
|
||||
# require C11 and C++17
|
||||
target_compile_features(${target} PUBLIC c_std_11 cxx_std_17)
|
||||
|
||||
# define the export symbol of the module
|
||||
string(REPLACE "-" "_" NAME_UPPER "${target}")
|
||||
string(TOUPPER "${NAME_UPPER}" NAME_UPPER)
|
||||
set_target_properties(${target} PROPERTIES DEFINE_SYMBOL ${NAME_UPPER}_EXPORTS)
|
||||
|
||||
# adjust the output file prefix/suffix to match our conventions
|
||||
if(WINDOWS)
|
||||
# include the major version number in Windows shared library names (but not import library names)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set_target_properties(${target} PROPERTIES DEBUG_POSTFIX -d)
|
||||
set_target_properties(${target} PROPERTIES SUFFIX "-${VERSION_MAJOR}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
if(SFML_OS_WINDOWS)
|
||||
# include the major version number in Windows shared library names (but not import library names)
|
||||
set_target_properties(${target} PROPERTIES SUFFIX "-${PROJECT_VERSION_MAJOR}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
|
||||
# on Windows/gcc get rid of "lib" prefix for shared libraries,
|
||||
# and transform the ".dll.a" suffix into ".a" for import libraries
|
||||
if (SFML_COMPILER_GCC OR SFML_COMPILER_CLANG)
|
||||
set_target_properties(${target} PROPERTIES PREFIX "")
|
||||
set_target_properties(${target} PROPERTIES IMPORT_SUFFIX ".a")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
set_target_properties(${target} PROPERTIES DEBUG_POSTFIX -d)
|
||||
endif()
|
||||
if (WINDOWS AND COMPILER_GCC)
|
||||
# on Windows/gcc get rid of "lib" prefix for shared libraries,
|
||||
# and transform the ".dll.a" suffix into ".a" for import libraries
|
||||
set_target_properties(${target} PROPERTIES PREFIX "")
|
||||
set_target_properties(${target} PROPERTIES IMPORT_SUFFIX ".a")
|
||||
endif()
|
||||
set_target_properties(${target} PROPERTIES DEBUG_POSTFIX -s-d)
|
||||
set_target_properties(${target} PROPERTIES RELEASE_POSTFIX -s)
|
||||
set_target_properties(${target} PROPERTIES MINSIZEREL_POSTFIX -s)
|
||||
set_target_properties(${target} PROPERTIES RELWITHDEBINFO_POSTFIX -s)
|
||||
|
||||
# set the version and soversion of the target (for compatible systems -- mostly Linuxes)
|
||||
set_target_properties(${target} PROPERTIES SOVERSION ${VERSION_MAJOR})
|
||||
set_target_properties(${target} PROPERTIES VERSION ${VERSION_MAJOR}.${VERSION_MINOR})
|
||||
|
||||
# for gcc >= 4.0 on Windows, apply the STATIC_STD_LIBS option if it is enabled
|
||||
if(WINDOWS AND COMPILER_GCC AND STATIC_STD_LIBS)
|
||||
if(NOT GCC_VERSION VERSION_LESS "4")
|
||||
set_target_properties(${target} PROPERTIES LINK_FLAGS "-static-libgcc -static-libstdc++")
|
||||
if(CSFML_USE_STATIC_STD_LIBS)
|
||||
set_property(TARGET ${target} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# If using gcc >= 4.0 or clang >= 3.0 on a non-Windows platform, we must hide public symbols by default
|
||||
# (exported ones are explicitely marked)
|
||||
if(NOT WINDOWS AND ((COMPILER_GCC AND NOT GCC_VERSION VERSION_LESS "4") OR (COMPILER_CLANG AND NOT CLANG_VERSION VERSION_LESS "3")))
|
||||
set_target_properties(${target} PROPERTIES COMPILE_FLAGS -fvisibility=hidden)
|
||||
# set the version and soversion of the target (for compatible systems -- mostly Linuxes)
|
||||
set_target_properties(${target} PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})
|
||||
set_target_properties(${target} PROPERTIES VERSION ${PROJECT_VERSION})
|
||||
|
||||
# set the target's folder (for IDEs that support it, e.g. Visual Studio)
|
||||
set_target_properties(${target} PROPERTIES FOLDER "CSFML")
|
||||
|
||||
# apply the CSFML_USE_STATIC_STD_LIBS option if it is enabled
|
||||
if(SFML_OS_WINDOWS AND SFML_COMPILER_GCC)
|
||||
if(CSFML_USE_STATIC_STD_LIBS AND NOT SFML_COMPILER_GCC_TDM)
|
||||
set_target_properties(${target} PROPERTIES LINK_FLAGS "-static-libgcc -static-libstdc++")
|
||||
elseif(NOT CSFML_USE_STATIC_STD_LIBS AND SFML_COMPILER_GCC_TDM)
|
||||
set_target_properties(${target} PROPERTIES LINK_FLAGS "-shared-libgcc -shared-libstdc++")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# ensure public symbols are hidden by default (exported ones are explicitly marked)
|
||||
set_target_properties(${target} PROPERTIES CXX_VISIBILITY_PRESET hidden VISIBILITY_INLINES_HIDDEN YES)
|
||||
|
||||
# link the target to its external dependencies (C++ SFML libraries)
|
||||
target_link_libraries(${target} ${THIS_DEPENDS})
|
||||
target_link_libraries(${target} PRIVATE ${THIS_DEPENDS})
|
||||
|
||||
# build dylibs
|
||||
if(SFML_OS_MACOSX AND BUILD_SHARED_LIBS)
|
||||
# adapt install directory to allow distributing dylibs in user’s application bundle
|
||||
set_target_properties(${target} PROPERTIES INSTALL_NAME_DIR "@rpath")
|
||||
endif()
|
||||
|
||||
# add the install rule
|
||||
install(TARGETS ${target}
|
||||
RUNTIME DESTINATION bin COMPONENT bin
|
||||
LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT bin
|
||||
LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT bin
|
||||
ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT devel)
|
||||
|
||||
# define CSFML_STATIC if the build type is not set to 'shared'
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(${target} PUBLIC CSFML_STATIC)
|
||||
endif()
|
||||
|
||||
endmacro()
|
||||
@@ -0,0 +1,34 @@
|
||||
# Check executable exists
|
||||
if(NOT EXISTS ${CLANG_TIDY_EXECUTABLE})
|
||||
find_program(CLANG_TIDY_EXEC_TEMP ${CLANG_TIDY_EXECUTABLE})
|
||||
if(CLANG_TIDY_EXEC_TEMP)
|
||||
set(CLANG_TIDY_EXECUTABLE ${CLANG_TIDY_EXEC_TEMP})
|
||||
unset(CLANG_TIDY_EXEC_TEMP)
|
||||
else()
|
||||
message(FATAL_ERROR "Unable to find clang-tidy executable: \"${CLANG_TIDY_EXECUTABLE}\"")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Check executable version
|
||||
execute_process(COMMAND ${CLANG_TIDY_EXECUTABLE} --version OUTPUT_VARIABLE CLANG_TIDY_VERSION)
|
||||
string(REGEX MATCH "version ([0-9]+)" CLANG_TIDY_VERSION ${CLANG_TIDY_VERSION})
|
||||
unset(CLANG_TIDY_VERSION)
|
||||
if(CMAKE_MATCH_1 GREATER_EQUAL 14)
|
||||
message(STATUS "Using clang-tidy version ${CMAKE_MATCH_1}")
|
||||
else()
|
||||
message(FATAL_ERROR "clang-tidy version ${CMAKE_MATCH_1} is too low")
|
||||
endif()
|
||||
|
||||
# Find Python and run-clang-tidy script
|
||||
find_package(Python 3 REQUIRED)
|
||||
|
||||
find_program(RUN_CLANG_TIDY run-clang-tidy)
|
||||
if(NOT RUN_CLANG_TIDY)
|
||||
message(FATAL_ERROR "Failed to find run-clang-tidy script")
|
||||
endif()
|
||||
|
||||
# Run
|
||||
execute_process(COMMAND ${Python_EXECUTABLE} ${RUN_CLANG_TIDY} -clang-tidy-binary ${CLANG_TIDY_EXECUTABLE} -quiet -p ${PROJECT_BINARY_DIR} RESULTS_VARIABLE EXIT_CODE)
|
||||
if(NOT EXIT_CODE STREQUAL 0)
|
||||
message(FATAL_ERROR "Analysis failed")
|
||||
endif()
|
||||
+17
-22
@@ -1,50 +1,45 @@
|
||||
|
||||
# find doxygen
|
||||
find_package(Doxygen REQUIRED)
|
||||
|
||||
# set the input and output documentation paths
|
||||
set(DOXYGEN_INPUT_DIR ${CMAKE_SOURCE_DIR})
|
||||
set(DOXYGEN_OUTPUT_DIR ${CMAKE_BINARY_DIR}/doc)
|
||||
|
||||
# see if we can generate the CHM documentation
|
||||
if(WINDOWS)
|
||||
set(DOXYGEN_HHC_PROGRAM)
|
||||
set(DOXYGEN_GENERATE_HTMLHELP NO)
|
||||
if(SFML_OS_WINDOWS)
|
||||
# if HHC is found, we can generate the CHM (compressed HTML) output
|
||||
find_program(DOXYGEN_HHC_PROGRAM
|
||||
NAMES hhc.exe
|
||||
PATHS "c:/Program Files/HTML Help Workshop"
|
||||
PATHS "C:/Program Files/HTML Help Workshop" "C:/Program Files (x86)/HTML Help Workshop"
|
||||
DOC "HTML Help Compiler program")
|
||||
if(DOXYGEN_HHC_PROGRAM)
|
||||
set(DOXYGEN_GENERATE_HTMLHELP YES)
|
||||
else()
|
||||
set(DOXYGEN_GENERATE_HTMLHELP NO)
|
||||
if(DOXYGEN_VERSION VERSION_LESS "1.10.0")
|
||||
set(DOXYGEN_GENERATE_HTMLHELP YES)
|
||||
else()
|
||||
message("Due to conflicts with the HTML output settings in Doxygen ${DOXYGEN_VERSION}, the HTML Help generation will be disabled")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
set(DOXYGEN_HHC_PROGRAM)
|
||||
set(DOXYGEN_GENERATE_HTMLHELP NO)
|
||||
endif()
|
||||
|
||||
# configure the source Doxyfile by copying it and replacing all @variables@
|
||||
set(DOXYGEN_CONFIGURED_INPUT ${DOXYGEN_OUTPUT_DIR}/doxyfile)
|
||||
configure_file(${DOXYGEN_INPUT_DIR}/doc/doxyfile.in ${DOXYGEN_CONFIGURED_INPUT} @ONLY)
|
||||
configure_file(doxyfile.in doxyfile @ONLY)
|
||||
configure_file(header.html.in header.html @ONLY)
|
||||
|
||||
# copy the files needed by the documentation
|
||||
configure_file(${DOXYGEN_INPUT_DIR}/doc/doxygen.css ${DOXYGEN_OUTPUT_DIR}/html/doxygen.css COPYONLY)
|
||||
configure_file(${DOXYGEN_INPUT_DIR}/doc/logo.jpg ${DOXYGEN_OUTPUT_DIR}/html/logo.jpg COPYONLY)
|
||||
configure_file(${DOXYGEN_INPUT_DIR}/doc/logo-bg.jpg ${DOXYGEN_OUTPUT_DIR}/html/logo-bg.jpg COPYONLY)
|
||||
configure_file(doxygen.css html/doxygen.css COPYONLY)
|
||||
configure_file(searchOverrides.css html/searchOverrides.css COPYONLY)
|
||||
|
||||
# target setup
|
||||
add_custom_target(doc ALL
|
||||
COMMAND ${CMAKE_COMMAND} -E echo_append "Building API Documentation..."
|
||||
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_CONFIGURED_INPUT}
|
||||
COMMAND Doxygen::doxygen ${CMAKE_CURRENT_BINARY_DIR}/doxyfile
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "Done."
|
||||
WORKING_DIRECTORY ${DOXYGEN_INPUT_DIR})
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
|
||||
|
||||
# setup install rules
|
||||
install(DIRECTORY ${DOXYGEN_OUTPUT_DIR}/html
|
||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html
|
||||
DESTINATION ${INSTALL_MISC_DIR}/doc
|
||||
COMPONENT doc)
|
||||
if(DOXYGEN_HHC_PROGRAM)
|
||||
install(FILES ${DOXYGEN_OUTPUT_DIR}/SFML.chm
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CSFML.chm
|
||||
DESTINATION ${INSTALL_MISC_DIR}/doc
|
||||
COMPONENT doc)
|
||||
endif()
|
||||
+2274
-904
File diff suppressed because it is too large.
Load diff
+1237
-419
File diff suppressed because it is too large.
Load diff
@@ -1,8 +0,0 @@
|
||||
|
||||
<p id="footer">
|
||||
:: Copyright © 2007 Laurent Gomila, all rights reserved ::
|
||||
Documentation generated by <a href="http://www.doxygen.org/" title="doxygen website">doxygen 1.5.2</a> ::
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,10 @@
|
||||
</div>
|
||||
<div id="footer-container">
|
||||
<div id="footer">
|
||||
CSFML is licensed under the terms and conditions of the <a href="https://www.sfml-dev.org/license.php">zlib/png license</a>.<br />
|
||||
Copyright © Laurent Gomila ::
|
||||
Documentation generated by <a href="https://www.doxygen.nl/" title="doxygen website">doxygen</a> ::
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,12 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>SFML - Simple and Fast Multimedia Library</title>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="logo">
|
||||
<img src="./logo.jpg" width="770" height="200" title="SFML home" alt="SFML logo" />
|
||||
</div>
|
||||
@@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>CSFML - C binding of the Simple and Fast Multimedia Library</title>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
|
||||
<!--<link rel='stylesheet' type='text/css' href="http://fonts.googleapis.com/css?family=Ubuntu:400,700,400italic"/>-->
|
||||
<link rel="stylesheet" type="text/css" href="doxygen.css" title="default" media="screen,print" />
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<script type="text/javascript" src="clipboard.js"></script>
|
||||
<script type="text/javascript" src="cookie.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="search/search.css" />
|
||||
<link rel="stylesheet" type="text/css" href="searchOverrides.css" />
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(document).ready(function() { init_search(); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="banner-container">
|
||||
<div id="banner">
|
||||
<span id="sfml">CSFML @PROJECT_VERSION@</span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="content">
|
||||
<div>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 22 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 114 KiB |
+17
-18
@@ -3,22 +3,21 @@
|
||||
///
|
||||
/// \section welcome Welcome
|
||||
/// Welcome to the official SFML documentation for C. Here you will find a detailed
|
||||
/// view of all the SFML <a href="./globals_func.htm">functions</a>, as well as source
|
||||
/// <a href="./files.htm">files</a>. <br/>
|
||||
/// view of all the SFML <a href="./globals_func.html">functions</a>.<br/>
|
||||
/// If you are looking for tutorials, you can visit the official website
|
||||
/// at <a href="http://www.sfml-dev.org/tutorials/">www.sfml-dev.org</a>.
|
||||
/// at <a href="https://www.sfml-dev.org/">www.sfml-dev.org</a>.
|
||||
///
|
||||
/// \section example Short example
|
||||
/// Here is a short example, to show you how simple it is to use SFML in C :
|
||||
///
|
||||
/// \code
|
||||
///
|
||||
/// #include <SFML/Audio.h>
|
||||
/// #include <SFML/Graphics.h>
|
||||
///
|
||||
/// #include <CSFML/Audio.h>
|
||||
/// #include <CSFML/Graphics.h>
|
||||
///
|
||||
/// int main()
|
||||
/// {
|
||||
/// sfVideoMode mode = {800, 600, 32};
|
||||
/// sfVideoMode mode = {{800, 600}, 32};
|
||||
/// sfRenderWindow* window;
|
||||
/// sfTexture* texture;
|
||||
/// sfSprite* sprite;
|
||||
@@ -33,12 +32,12 @@
|
||||
/// return EXIT_FAILURE;
|
||||
///
|
||||
/// /* Load a sprite to display */
|
||||
/// texture = sfTexture_createFromFile("cute_image.jpg");
|
||||
/// texture = sfTexture_createFromFile("cute_image.jpg", NULL);
|
||||
/// if (!texture)
|
||||
/// return EXIT_FAILURE;
|
||||
/// sprite = sfSprite_create();
|
||||
/// sfSprite_setTexture(sprite, texture, sfTrue);
|
||||
///
|
||||
/// sfSprite_setTexture(sprite, texture, true);
|
||||
///
|
||||
/// /* Create a graphical text to display */
|
||||
/// font = sfFont_createFromFile("arial.ttf");
|
||||
/// if (!font)
|
||||
@@ -47,7 +46,7 @@
|
||||
/// sfText_setString(text, "Hello SFML");
|
||||
/// sfText_setFont(text, font);
|
||||
/// sfText_setCharacterSize(text, 50);
|
||||
///
|
||||
///
|
||||
/// /* Load a music to play */
|
||||
/// music = sfMusic_createFromFile("nice_music.ogg");
|
||||
/// if (!music)
|
||||
@@ -55,7 +54,7 @@
|
||||
///
|
||||
/// /* Play the music */
|
||||
/// sfMusic_play(music);
|
||||
///
|
||||
///
|
||||
/// /* Start the game loop */
|
||||
/// while (sfRenderWindow_isOpen(window))
|
||||
/// {
|
||||
@@ -66,20 +65,20 @@
|
||||
/// if (event.type == sfEvtClosed)
|
||||
/// sfRenderWindow_close(window);
|
||||
/// }
|
||||
///
|
||||
///
|
||||
/// /* Clear the screen */
|
||||
/// sfRenderWindow_clear(window, sfBlack);
|
||||
///
|
||||
///
|
||||
/// /* Draw the sprite */
|
||||
/// sfRenderWindow_drawSprite(window, sprite, NULL);
|
||||
///
|
||||
///
|
||||
/// /* Draw the text */
|
||||
/// sfRenderWindow_drawText(window, text, NULL);
|
||||
///
|
||||
///
|
||||
/// /* Update the window */
|
||||
/// sfRenderWindow_display(window);
|
||||
/// }
|
||||
///
|
||||
///
|
||||
/// /* Cleanup resources */
|
||||
/// sfMusic_destroy(music);
|
||||
/// sfText_destroy(text);
|
||||
@@ -87,7 +86,7 @@
|
||||
/// sfSprite_destroy(sprite);
|
||||
/// sfTexture_destroy(texture);
|
||||
/// sfRenderWindow_destroy(window);
|
||||
///
|
||||
///
|
||||
/// return EXIT_SUCCESS;
|
||||
/// }
|
||||
/// \endcode
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/* Override search/search.css rules to adjust seach box placement */
|
||||
#MSearchBox {
|
||||
position: relative;
|
||||
display: block;
|
||||
border-radius: 0;
|
||||
box-shadow: none;
|
||||
border-width: 1px;
|
||||
border-color: #BBB;
|
||||
border-style: solid;
|
||||
}
|
||||
.right #MSearchClose {
|
||||
margin: 0;
|
||||
right: auto;
|
||||
}
|
||||
#MSearchResultsWindow {
|
||||
background-color: #EAF5DB;
|
||||
border-color: #999;
|
||||
}
|
||||
#MSearchResults > .SRPage {
|
||||
background-color: #EAF5DB;
|
||||
}
|
||||
a.SRSymbol {
|
||||
color: rgb(70, 100, 30);
|
||||
}
|
||||
a.SRSymbol:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
a.SRScope {
|
||||
color: rgb(70, 100, 30);
|
||||
}
|
||||
a.SRScope:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
#MSearchSelectWindow {
|
||||
background-color: #EAF5DB;
|
||||
}
|
||||
#MSearchSelectWindow > a.SelectItem {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
}
|
||||
#MSearchSelectWindow > a.SelectItem:hover {
|
||||
color: white;
|
||||
background-color: #8CC841;
|
||||
text-decoration: none;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
add_executable(example example.c)
|
||||
target_link_libraries(example PRIVATE csfml-graphics csfml-audio)
|
||||
set_target_warnings(example)
|
||||
Binary file not shown.
@@ -0,0 +1,87 @@
|
||||
#include <CSFML/Audio.h>
|
||||
#include <CSFML/Graphics.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// Create the main window
|
||||
const sfVideoMode mode = {{800, 600}, 32};
|
||||
sfRenderWindow* window = sfRenderWindow_create(mode, "SFML window", sfResize | sfClose, sfWindowed, NULL);
|
||||
if (!window)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
// Load a sprite to display
|
||||
const sfTexture* texture = sfTexture_createFromFile("sfml_logo.png", NULL);
|
||||
if (!texture)
|
||||
{
|
||||
sfRenderWindow_destroy(window);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
sfSprite* sprite = sfSprite_create(texture);
|
||||
const sfVector2f spritePosition = {200, 200};
|
||||
sfSprite_setPosition(sprite, spritePosition);
|
||||
|
||||
// Create a graphical text to display
|
||||
const sfFont* font = sfFont_createFromFile("tuffy.ttf");
|
||||
if (!font)
|
||||
{
|
||||
sfSprite_destroy(sprite);
|
||||
sfTexture_destroy(texture);
|
||||
sfRenderWindow_destroy(window);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
sfText* text = sfText_create(font);
|
||||
sfText_setString(text, "Hello, SFML!");
|
||||
sfText_setCharacterSize(text, 50);
|
||||
|
||||
// Load a music to play
|
||||
sfMusic* music = sfMusic_createFromFile("doodle_pop.ogg");
|
||||
if (!music)
|
||||
{
|
||||
sfText_destroy(text);
|
||||
sfFont_destroy(font);
|
||||
sfSprite_destroy(sprite);
|
||||
sfTexture_destroy(texture);
|
||||
sfRenderWindow_destroy(window);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// Play the music
|
||||
sfMusic_play(music);
|
||||
|
||||
// Start the game loop
|
||||
sfEvent event;
|
||||
while (sfRenderWindow_isOpen(window))
|
||||
{
|
||||
// Process events
|
||||
while (sfRenderWindow_pollEvent(window, &event))
|
||||
{
|
||||
// Close window : exit
|
||||
if (event.type == sfEvtClosed)
|
||||
sfRenderWindow_close(window);
|
||||
}
|
||||
|
||||
// Clear the screen
|
||||
sfRenderWindow_clear(window, sfBlack);
|
||||
|
||||
// Draw the sprite
|
||||
sfRenderWindow_drawSprite(window, sprite, NULL);
|
||||
|
||||
// Draw the text
|
||||
sfRenderWindow_drawText(window, text, NULL);
|
||||
|
||||
// Update the window
|
||||
sfRenderWindow_display(window);
|
||||
}
|
||||
|
||||
// Cleanup resources
|
||||
sfMusic_destroy(music);
|
||||
sfText_destroy(text);
|
||||
sfFont_destroy(font);
|
||||
sfSprite_destroy(sprite);
|
||||
sfTexture_destroy(texture);
|
||||
sfRenderWindow_destroy(window);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
Executable
BIN
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,20 +22,18 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_NETWORK_H
|
||||
#define SFML_NETWORK_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#include <SFML/System.h>
|
||||
#include <SFML/Network/IpAddress.h>
|
||||
#include <SFML/Network/Packet.h>
|
||||
#include <SFML/Network/SocketSelector.h>
|
||||
#include <SFML/Network/TcpListener.h>
|
||||
#include <SFML/Network/TcpSocket.h>
|
||||
#include <SFML/Network/UdpSocket.h>
|
||||
|
||||
|
||||
#endif // SFML_NETWORK_H
|
||||
#include <CSFML/Audio/Listener.h>
|
||||
#include <CSFML/Audio/Music.h>
|
||||
#include <CSFML/Audio/Sound.h>
|
||||
#include <CSFML/Audio/SoundBuffer.h>
|
||||
#include <CSFML/Audio/SoundBufferRecorder.h>
|
||||
#include <CSFML/Audio/SoundRecorder.h>
|
||||
#include <CSFML/Audio/SoundStatus.h>
|
||||
#include <CSFML/Audio/SoundStream.h>
|
||||
#include <CSFML/System.h>
|
||||
@@ -0,0 +1,106 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Callable that is provided with sound data for processing
|
||||
///
|
||||
/// When the audio engine sources sound data from sound
|
||||
/// sources it will pass the data through an effects
|
||||
/// processor if one is set. The sound data will already be
|
||||
/// converted to the internal floating point format.
|
||||
///
|
||||
/// Sound data that is processed this way is provided in
|
||||
/// frames. Each frame contains 1 floating point sample per
|
||||
/// channel. If e.g. the data source provides stereo data,
|
||||
/// each frame will contain 2 floats.
|
||||
///
|
||||
/// The effects processor function takes 4 parameters:
|
||||
/// - The input data frames, channels interleaved
|
||||
/// - The number of input data frames available
|
||||
/// - The buffer to write output data frames to, channels interleaved
|
||||
/// - The number of output data frames that the output buffer can hold
|
||||
/// - The channel count
|
||||
///
|
||||
/// The input and output frame counts are in/out parameters.
|
||||
///
|
||||
/// When this function is called, the input count will
|
||||
/// contain the number of frames available in the input
|
||||
/// buffer. The output count will contain the size of the
|
||||
/// output buffer i.e. the maximum number of frames that
|
||||
/// can be written to the output buffer.
|
||||
///
|
||||
/// Attempting to read more frames than the input frame
|
||||
/// count or write more frames than the output frame count
|
||||
/// will result in undefined behaviour.
|
||||
///
|
||||
/// It is important to note that the channel count of the
|
||||
/// audio engine currently sourcing data from this sound
|
||||
/// will always be provided in `frameChannelCount`. This can
|
||||
/// be different from the channel count of the sound source
|
||||
/// so make sure to size necessary processing buffers
|
||||
/// according to the engine channel count and not the sound
|
||||
/// source channel count.
|
||||
///
|
||||
/// When done processing the frames, the input and output
|
||||
/// frame counts must be updated to reflect the actual
|
||||
/// number of frames that were read from the input and
|
||||
/// written to the output.
|
||||
///
|
||||
/// The processing function should always try to process as
|
||||
/// much sound data as possible i.e. always try to fill the
|
||||
/// output buffer to the maximum. In certain situations for
|
||||
/// specific effects it can be possible that the input frame
|
||||
/// count and output frame count aren't equal. As long as
|
||||
/// the frame counts are updated accordingly this is
|
||||
/// perfectly valid.
|
||||
///
|
||||
/// If the audio engine determines that no audio data is
|
||||
/// available from the data source, the input data frames
|
||||
/// pointer is set to `NULL` and the input frame count is
|
||||
/// set to 0. In this case it is up to the function to
|
||||
/// decide how to handle the situation. For specific effects
|
||||
/// e.g. Echo/Delay buffered data might still be able to be
|
||||
/// written to the output buffer even if there is no longer
|
||||
/// any input data.
|
||||
///
|
||||
/// An important thing to remember is that this function is
|
||||
/// directly called by the audio engine. Because the audio
|
||||
/// engine runs on an internal thread of its own, make sure
|
||||
/// access to shared data is synchronized appropriately.
|
||||
///
|
||||
/// Because this function is stored by the `SoundSource`
|
||||
/// object it will be able to be called as long as the
|
||||
/// `SoundSource` object hasn't yet been destroyed. Make sure
|
||||
/// that any data this function references outlives the
|
||||
/// SoundSource object otherwise use-after-free errors will
|
||||
/// occur.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef void (*sfEffectProcessor)(const float* inputFrames,
|
||||
unsigned int* inputFrameCount,
|
||||
float* outputFrames,
|
||||
unsigned int* outputFrameCount,
|
||||
unsigned int frameChannelCount);
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,13 +22,12 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_AUDIO_EXPORT_H
|
||||
#define SFML_AUDIO_EXPORT_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <CSFML/Config.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -36,13 +35,10 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
#if defined(CSFML_AUDIO_EXPORTS)
|
||||
|
||||
#define CSFML_AUDIO_API CSFML_API_EXPORT
|
||||
#define CSFML_AUDIO_API CSFML_API_EXPORT
|
||||
|
||||
#else
|
||||
|
||||
#define CSFML_AUDIO_API CSFML_API_IMPORT
|
||||
#define CSFML_AUDIO_API CSFML_API_IMPORT
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif // SFML_AUDIO_EXPORT_H
|
||||
@@ -0,0 +1,173 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <CSFML/Audio/Export.h>
|
||||
|
||||
#include <CSFML/System/Vector3.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Structure defining the properties of a directional cone
|
||||
///
|
||||
/// Sounds will play at gain 1 when they are positioned
|
||||
/// within the inner angle of the cone. Sounds will play
|
||||
/// at `outerGain` when they are positioned outside the
|
||||
/// outer angle of the cone. The gain declines linearly
|
||||
/// from 1 to `outerGain` as the sound moves from the inner
|
||||
/// angle to the outer angle.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
float innerAngle; //!< Inner angle, in degrees
|
||||
float outerAngle; //!< Outer angle, in degrees
|
||||
float outerGain; //!< Outer gain
|
||||
} sfListenerCone;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change the global volume of all the sounds and musics
|
||||
///
|
||||
/// The volume is a number between 0 and 100; it is combined with
|
||||
/// the individual volume of each sound / music.
|
||||
/// The default value for the volume is 100 (maximum).
|
||||
///
|
||||
/// \param volume New global volume, in the range [0, 100]
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfListener_setGlobalVolume(float volume);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current value of the global volume
|
||||
///
|
||||
/// \return Current global volume, in the range [0, 100]
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API float sfListener_getGlobalVolume(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the position of the listener in the scene
|
||||
///
|
||||
/// The default listener's position is (0, 0, 0).
|
||||
///
|
||||
/// \param position New position of the listener
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfListener_setPosition(sfVector3f position);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current position of the listener in the scene
|
||||
///
|
||||
/// \return The listener's position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfVector3f sfListener_getPosition(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the orientation of the forward vector in the scene
|
||||
///
|
||||
/// The direction (also called "at vector") is the vector
|
||||
/// pointing forward from the listener's perspective. Together
|
||||
/// with the up vector, it defines the 3D orientation of the
|
||||
/// listener in the scene. The direction vector doesn't
|
||||
/// have to be normalized.
|
||||
/// The default listener's direction is (0, 0, -1).
|
||||
///
|
||||
/// \param direction New listener's direction
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfListener_setDirection(sfVector3f direction);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current forward vector of the listener in the scene
|
||||
///
|
||||
/// \return Listener's forward vector (not normalized)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfVector3f sfListener_getDirection(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the velocity of the listener in the scene
|
||||
///
|
||||
/// The default listener's velocity is (0, 0, -1).
|
||||
///
|
||||
/// \param velocity New listener's velocity
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfListener_setVelocity(sfVector3f velocity);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current forward vector of the listener in the scene
|
||||
///
|
||||
/// \return Listener's velocity
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfVector3f sfListener_getVelocity(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the cone properties of the listener in the audio scene
|
||||
///
|
||||
/// The cone defines how directional attenuation is applied.
|
||||
/// The default cone of a sound is (2 * PI, 2 * PI, 1).
|
||||
///
|
||||
/// \param cone Cone properties of the listener in the scene
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfListener_setCone(sfListenerCone cone);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the cone properties of the listener in the audio scene
|
||||
///
|
||||
/// \return Cone properties of the listener
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfListenerCone sfListener_getCone(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the upward vector of the listener in the scene
|
||||
///
|
||||
/// The up vector is the vector that points upward from the
|
||||
/// listener's perspective. Together with the direction, it
|
||||
/// defines the 3D orientation of the listener in the scene.
|
||||
/// The up vector doesn't have to be normalized.
|
||||
/// The default listener's up vector is (0, 1, 0). It is usually
|
||||
/// not necessary to change it, especially in 2D scenarios.
|
||||
///
|
||||
/// \param upVector New listener's up vector
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfListener_setUpVector(sfVector3f upVector);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current upward vector of the listener in the scene
|
||||
///
|
||||
/// \return Listener's upward vector (not normalized)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfVector3f sfListener_getUpVector(void);
|
||||
@@ -0,0 +1,694 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <CSFML/Audio/Export.h>
|
||||
|
||||
#include <CSFML/Audio/EffectProcessor.h>
|
||||
#include <CSFML/Audio/SoundChannel.h>
|
||||
#include <CSFML/Audio/SoundSourceCone.h>
|
||||
#include <CSFML/Audio/SoundStatus.h>
|
||||
#include <CSFML/Audio/Types.h>
|
||||
#include <CSFML/System/InputStream.h>
|
||||
#include <CSFML/System/Time.h>
|
||||
#include <CSFML/System/Vector3.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Structure defining a time range
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
sfTime offset; ///< The beginning offset of the time range
|
||||
sfTime length; ///< The length of the time range
|
||||
} sfTimeSpan;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new music and load it from a file
|
||||
///
|
||||
/// This function doesn't start playing the music (call
|
||||
/// sfMusic_play to do so).
|
||||
/// Here is a complete list of all the supported audio formats:
|
||||
/// ogg, wav, flac, mp3, aiff, au, raw, paf, svx, nist, voc, ircam,
|
||||
/// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
|
||||
///
|
||||
/// \param filename Path of the music file to open
|
||||
///
|
||||
/// \return A new sfMusic object (NULL if failed)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfMusic* sfMusic_createFromFile(const char* filename);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new music and load it from a file in memory
|
||||
///
|
||||
/// This function doesn't start playing the music (call
|
||||
/// sfMusic_play to do so).
|
||||
/// Here is a complete list of all the supported audio formats:
|
||||
/// ogg, wav, flac, mp3, aiff, au, raw, paf, svx, nist, voc, ircam,
|
||||
/// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
|
||||
///
|
||||
/// \param data Pointer to the file data in memory
|
||||
/// \param sizeInBytes Size of the data to load, in bytes
|
||||
///
|
||||
/// \return A new sfMusic object (NULL if failed)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfMusic* sfMusic_createFromMemory(const void* data, size_t sizeInBytes);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new music and load it from a custom stream
|
||||
///
|
||||
/// This function doesn't start playing the music (call
|
||||
/// sfMusic_play to do so).
|
||||
/// Here is a complete list of all the supported audio formats:
|
||||
/// ogg, wav, flac, mp3, aiff, au, raw, paf, svx, nist, voc, ircam,
|
||||
/// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
|
||||
///
|
||||
/// \param stream Source stream to read from
|
||||
///
|
||||
/// \return A new sfMusic object (NULL if failed)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfMusic* sfMusic_createFromStream(sfInputStream* stream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destroy a music
|
||||
///
|
||||
/// \param music Music to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfMusic_destroy(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set whether or not a music should loop after reaching the end
|
||||
///
|
||||
/// If set, the music will restart from beginning after
|
||||
/// reaching the end and so on, until it is stopped or
|
||||
/// sfMusic_setLooping(music, false) is called.
|
||||
/// The default looping state for musics is false.
|
||||
///
|
||||
/// \param music Music object
|
||||
/// \param loop true to play in loop, false to play once
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfMusic_setLooping(sfMusic* music, bool loop);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether or not a music is in loop mode
|
||||
///
|
||||
/// \param music Music object
|
||||
///
|
||||
/// \return true if the music is looping, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API bool sfMusic_isLooping(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the effect processor to be applied to the sound
|
||||
///
|
||||
/// The effect processor is a callable that will be called
|
||||
/// with sound data to be processed.
|
||||
///
|
||||
/// \param music Music object
|
||||
/// \param effectProcessor The effect processor to attach to this sound, attach a null processor to disable processing
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfMusic_setEffectProcessor(sfMusic* music, sfEffectProcessor effectProcessor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the total duration of a music
|
||||
///
|
||||
/// \param music Music object
|
||||
///
|
||||
/// \return Music duration
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfTime sfMusic_getDuration(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the positions of the of the sound's looping sequence
|
||||
///
|
||||
/// \param music Music object
|
||||
///
|
||||
/// \return Loop Time position class.
|
||||
///
|
||||
/// \warning Since sfMusic_setLoopPoints() performs some adjustments on the
|
||||
/// provided values and rounds them to internal samples, a call to
|
||||
/// sfMusic_getLoopPoints() is not guaranteed to return the same times passed
|
||||
/// into a previous call to sfMusic_setLoopPoints(). However, it is guaranteed
|
||||
/// to return times that will map to the valid internal samples of
|
||||
/// this Music if they are later passed to sfMusic_setLoopPoints().
|
||||
///
|
||||
/// \see setLoopPoints
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfTimeSpan sfMusic_getLoopPoints(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Sets the beginning and end of the sound's looping sequence using sfTime
|
||||
///
|
||||
/// Loop points allow one to specify a pair of positions such that, when the music
|
||||
/// is enabled for looping, it will seamlessly seek to the beginning whenever it
|
||||
/// encounters the end. Valid ranges for timePoints.offset and timePoints.length are
|
||||
/// [0, Dur) and (0, Dur-offset] respectively, where Dur is the value returned by sfMusic_getDuration().
|
||||
/// Note that the EOF "loop point" from the end to the beginning of the stream is still honored,
|
||||
/// in case the caller seeks to a point after the end of the loop range. This function can be
|
||||
/// safely called at any point after a stream is opened, and will be applied to a playing sound
|
||||
/// without affecting the current playing offset.
|
||||
///
|
||||
/// \warning Setting the loop points while the stream's status is Paused
|
||||
/// will set its status to Stopped. The playing offset will be unaffected.
|
||||
///
|
||||
/// \param music Music object
|
||||
/// \param timePoints The definition of the loop. Can be any time points within the sound's length
|
||||
///
|
||||
/// \see getLoopPoints
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfMusic_setLoopPoints(sfMusic* music, sfTimeSpan timePoints);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Start or resume playing a music
|
||||
///
|
||||
/// This function starts the music if it was stopped, resumes
|
||||
/// it if it was paused, and restarts it from beginning if it
|
||||
/// was it already playing.
|
||||
/// This function uses its own thread so that it doesn't block
|
||||
/// the rest of the program while the music is played.
|
||||
///
|
||||
/// \param music Music object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfMusic_play(sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Pause a music
|
||||
///
|
||||
/// This function pauses the music if it was playing,
|
||||
/// otherwise (music already paused or stopped) it has no effect.
|
||||
///
|
||||
/// \param music Music object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfMusic_pause(sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Stop playing a music
|
||||
///
|
||||
/// This function stops the music if it was playing or paused,
|
||||
/// and does nothing if it was already stopped.
|
||||
/// It also resets the playing position (unlike sfMusic_pause).
|
||||
///
|
||||
/// \param music Music object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfMusic_stop(sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return the number of channels of a music
|
||||
///
|
||||
/// 1 channel means a mono sound, 2 means stereo, etc.
|
||||
///
|
||||
/// \param music Music object
|
||||
///
|
||||
/// \return Number of channels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API unsigned int sfMusic_getChannelCount(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the sample rate of a music
|
||||
///
|
||||
/// The sample rate is the number of audio samples played per
|
||||
/// second. The higher, the better the quality.
|
||||
///
|
||||
/// \param music Music object
|
||||
///
|
||||
/// \return Sample rate, in number of samples per second
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API unsigned int sfMusic_getSampleRate(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the map of position in sample frame to sound channel
|
||||
///
|
||||
/// This is used to map a sample in the sample stream to a
|
||||
/// position during spatialization.
|
||||
///
|
||||
/// \param music Music object
|
||||
/// \param count Pointer to a variable that will be filled with the number of channels in the map
|
||||
///
|
||||
/// \return Map of position in sample frame to sound channel
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API const sfSoundChannel* sfMusic_getChannelMap(const sfMusic* music, size_t* count);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current status of a music (stopped, paused, playing)
|
||||
///
|
||||
/// \param music Music object
|
||||
///
|
||||
/// \return Current status
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfSoundStatus sfMusic_getStatus(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current playing position of a music
|
||||
///
|
||||
/// \param music Music object
|
||||
///
|
||||
/// \return Current playing position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfTime sfMusic_getPlayingOffset(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the pitch of a music
|
||||
///
|
||||
/// The pitch represents the perceived fundamental frequency
|
||||
/// of a sound; thus you can make a music more acute or grave
|
||||
/// by changing its pitch. A side effect of changing the pitch
|
||||
/// is to modify the playing speed of the music as well.
|
||||
/// The default value for the pitch is 1.
|
||||
///
|
||||
/// \param music Music object
|
||||
/// \param pitch New pitch to apply to the music
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfMusic_setPitch(sfMusic* music, float pitch);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the pan of the sound
|
||||
///
|
||||
/// Using panning, a mono sound can be panned between
|
||||
/// stereo channels. When the pan is set to -1, the sound
|
||||
/// is played only on the left channel, when the pan is set
|
||||
/// to +1, the sound is played only on the right channel.
|
||||
///
|
||||
/// \param music Music object
|
||||
/// \param pan New pan to apply to the sound [-1, +1]
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfMusic_setPan(sfMusic* music, float pan);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the volume of a music
|
||||
///
|
||||
/// The volume is a value between 0 (mute) and 100 (full volume).
|
||||
/// The default value for the volume is 100.
|
||||
///
|
||||
/// \param music Music object
|
||||
/// \param volume Volume of the music
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfMusic_setVolume(sfMusic* music, float volume);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set whether spatialization of the sound is enabled
|
||||
///
|
||||
/// Spatialization is the application of various effects to
|
||||
/// simulate a sound being emitted at a virtual position in
|
||||
/// 3D space and exhibiting various physical phenomena such as
|
||||
/// directional attenuation and doppler shift.
|
||||
///
|
||||
/// \param music Music object
|
||||
/// \param enabled `true` to enable spatialization, `false` to disable
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfMusic_setSpatializationEnabled(sfMusic* music, bool enabled);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the 3D position of a music in the audio scene
|
||||
///
|
||||
/// Only musics with one channel (mono musics) can be
|
||||
/// spatialized.
|
||||
/// The default position of a music is (0, 0, 0).
|
||||
///
|
||||
/// \param music Music object
|
||||
/// \param position Position of the music in the scene
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfMusic_setPosition(sfMusic* music, sfVector3f position);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the 3D direction of the sound in the audio scene
|
||||
///
|
||||
/// The direction defines where the sound source is facing
|
||||
/// in 3D space. It will affect how the sound is attenuated
|
||||
/// if facing away from the listener.
|
||||
/// The default direction of a sound is (0, 0, -1).
|
||||
///
|
||||
/// \param music Music object
|
||||
/// \param direction Direction of the sound in the scene
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfMusic_setDirection(sfMusic* music, sfVector3f direction);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the cone properties of the sound in the audio scene
|
||||
///
|
||||
/// The cone defines how directional attenuation is applied.
|
||||
/// The default cone of a sound is (2 * PI, 2 * PI, 1).
|
||||
///
|
||||
/// \param music Music object
|
||||
/// \param cone Cone properties of the sound in the scene
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfMusic_setCone(sfMusic* music, sfSoundSourceCone cone);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the 3D velocity of the sound in the audio scene
|
||||
///
|
||||
/// The velocity is used to determine how to doppler shift
|
||||
/// the sound. Sounds moving towards the listener will be
|
||||
/// perceived to have a higher pitch and sounds moving away
|
||||
/// from the listener will be perceived to have a lower pitch.
|
||||
///
|
||||
/// \param music Music object
|
||||
/// \param velocity Velocity of the sound in the scene
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfMusic_setVelocity(sfMusic* music, sfVector3f velocity);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the doppler factor of the sound
|
||||
///
|
||||
/// The doppler factor determines how strong the doppler
|
||||
/// shift will be.
|
||||
///
|
||||
/// \param music Music object
|
||||
/// \param factor New doppler factor to apply to the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfMusic_setDopplerFactor(sfMusic* music, float factor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the directional attenuation factor of the sound
|
||||
///
|
||||
/// Depending on the virtual position of an output channel
|
||||
/// relative to the listener (such as in surround sound
|
||||
/// setups), sounds will be attenuated when emitting them
|
||||
/// from certain channels. This factor determines how strong
|
||||
/// the attenuation based on output channel position
|
||||
/// relative to the listener is.
|
||||
///
|
||||
/// \param music Music object
|
||||
/// \param factor New directional attenuation factor to apply to the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfMusic_setDirectionalAttenuationFactor(sfMusic* music, float factor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Make a musics's position relative to the listener or absolute
|
||||
///
|
||||
/// Making a music relative to the listener will ensure that it will always
|
||||
/// be played the same way regardless the position of the listener.
|
||||
/// This can be useful for non-spatialized musics, musics that are
|
||||
/// produced by the listener, or musics attached to it.
|
||||
/// The default value is false (position is absolute).
|
||||
///
|
||||
/// \param music Music object
|
||||
/// \param relative true to set the position relative, false to set it absolute
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfMusic_setRelativeToListener(sfMusic* music, bool relative);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the minimum distance of a music
|
||||
///
|
||||
/// The "minimum distance" of a music is the maximum
|
||||
/// distance at which it is heard at its maximum volume. Further
|
||||
/// than the minimum distance, it will start to fade out according
|
||||
/// to its attenuation factor. A value of 0 ("inside the head
|
||||
/// of the listener") is an invalid value and is forbidden.
|
||||
/// The default value of the minimum distance is 1.
|
||||
///
|
||||
/// \param music Music object
|
||||
/// \param distance New minimum distance of the music
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfMusic_setMinDistance(sfMusic* music, float distance);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the maximum distance of the sound
|
||||
///
|
||||
/// The "maximum distance" of a sound is the minimum
|
||||
/// distance at which it is heard at its minimum volume. Closer
|
||||
/// than the maximum distance, it will start to fade in according
|
||||
/// to its attenuation factor.
|
||||
/// The default value of the maximum distance is the maximum
|
||||
/// value a float can represent.
|
||||
///
|
||||
/// \param music Music object
|
||||
/// \param distance New maximum distance of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfMusic_setMaxDistance(sfMusic* music, float distance);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the minimum gain of the sound
|
||||
///
|
||||
/// When the sound is further away from the listener than
|
||||
/// the "maximum distance" the attenuated gain is clamped
|
||||
/// so it cannot go below the minimum gain value.
|
||||
///
|
||||
/// \param music Music object
|
||||
/// \param gain New minimum gain of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfMusic_setMinGain(sfMusic* music, float gain);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the maximum gain of the sound
|
||||
///
|
||||
/// When the sound is closer from the listener than
|
||||
/// the "minimum distance" the attenuated gain is clamped
|
||||
/// so it cannot go above the maximum gain value.
|
||||
///
|
||||
/// \param music Music object
|
||||
/// \param gain New maximum gain of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfMusic_setMaxGain(sfMusic* music, float gain);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the attenuation factor of a music
|
||||
///
|
||||
/// The attenuation is a multiplicative factor which makes
|
||||
/// the music more or less loud according to its distance
|
||||
/// from the listener. An attenuation of 0 will produce a
|
||||
/// non-attenuated music, i.e. its volume will always be the same
|
||||
/// whether it is heard from near or from far. On the other hand,
|
||||
/// an attenuation value such as 100 will make the music fade out
|
||||
/// very quickly as it gets further from the listener.
|
||||
/// The default value of the attenuation is 1.
|
||||
///
|
||||
/// \param music Music object
|
||||
/// \param attenuation New attenuation factor of the music
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfMusic_setAttenuation(sfMusic* music, float attenuation);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change the current playing position of a music
|
||||
///
|
||||
/// The playing position can be changed when the music is
|
||||
/// either paused or playing.
|
||||
///
|
||||
/// \param music Music object
|
||||
/// \param timeOffset New playing position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfMusic_setPlayingOffset(sfMusic* music, sfTime timeOffset);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the pitch of a music
|
||||
///
|
||||
/// \param music Music object
|
||||
///
|
||||
/// \return Pitch of the music
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API float sfMusic_getPitch(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the pan of the sound
|
||||
///
|
||||
/// \param music Music object
|
||||
///
|
||||
/// \return Pan of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API float sfMusic_getPan(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether spatialization of the sound is enabled
|
||||
///
|
||||
/// \param music Music object
|
||||
///
|
||||
/// \return `true` if spatialization is enabled, `false` if it's disabled
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API bool sfMusic_isSpatializationEnabled(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the volume of a music
|
||||
///
|
||||
/// \param music Music object
|
||||
///
|
||||
/// \return Volume of the music, in the range [0, 100]
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API float sfMusic_getVolume(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the 3D position of a music in the audio scene
|
||||
///
|
||||
/// \param music Music object
|
||||
///
|
||||
/// \return Position of the music in the world
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfVector3f sfMusic_getPosition(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the 3D direction of the sound in the audio scene
|
||||
///
|
||||
/// \param music Music object
|
||||
///
|
||||
/// \return Direction of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfVector3f sfMusic_getDirection(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the cone properties of the sound in the audio scene
|
||||
///
|
||||
/// \param music Music object
|
||||
///
|
||||
/// \return Cone properties of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfSoundSourceCone sfMusic_getCone(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the 3D velocity of the sound in the audio scene
|
||||
///
|
||||
/// \param music Music object
|
||||
///
|
||||
/// \return Velocity of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfVector3f sfMusic_getVelocity(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the doppler factor of the sound
|
||||
///
|
||||
/// \param music Music object
|
||||
///
|
||||
/// \return Doppler factor of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API float sfMusic_getDopplerFactor(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the directional attenuation factor of the sound
|
||||
///
|
||||
/// \param music Music object
|
||||
///
|
||||
/// \return Directional attenuation factor of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API float sfMusic_getDirectionalAttenuationFactor(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether a music's position is relative to the
|
||||
/// listener or is absolute
|
||||
///
|
||||
/// \param music Music object
|
||||
///
|
||||
/// \return true if the position is relative, false if it's absolute
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API bool sfMusic_isRelativeToListener(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the minimum distance of a music
|
||||
///
|
||||
/// \param music Music object
|
||||
///
|
||||
/// \return Minimum distance of the music
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API float sfMusic_getMinDistance(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the maximum distance of the sound
|
||||
///
|
||||
/// \param music Music object
|
||||
///
|
||||
/// \return Maximum distance of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API float sfMusic_getMaxDistance(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the minimum gain of the sound
|
||||
///
|
||||
/// \param music Music object
|
||||
///
|
||||
/// \return Minimum gain of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API float sfMusic_getMinGain(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the maximum gain of the sound
|
||||
///
|
||||
/// \param music Music object
|
||||
///
|
||||
/// \return Maximum gain of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API float sfMusic_getMaxGain(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the attenuation factor of a music
|
||||
///
|
||||
/// \param music Music object
|
||||
///
|
||||
/// \return Attenuation factor of the music
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API float sfMusic_getAttenuation(const sfMusic* music);
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,26 +22,30 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SOUND_H
|
||||
#define SFML_SOUND_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Audio/Export.h>
|
||||
#include <SFML/Audio/SoundStatus.h>
|
||||
#include <SFML/Audio/Types.h>
|
||||
#include <SFML/System/Time.h>
|
||||
#include <SFML/System/Vector3.h>
|
||||
#include <CSFML/Audio/Export.h>
|
||||
|
||||
#include <CSFML/Audio/EffectProcessor.h>
|
||||
#include <CSFML/Audio/SoundSourceCone.h>
|
||||
#include <CSFML/Audio/SoundStatus.h>
|
||||
#include <CSFML/Audio/Types.h>
|
||||
#include <CSFML/System/Time.h>
|
||||
#include <CSFML/System/Vector3.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new sound
|
||||
///
|
||||
/// \param buffer Sound buffer containing the audio data to play with the sound
|
||||
///
|
||||
/// \return A new sfSound object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfSound* sfSound_create(void);
|
||||
CSFML_AUDIO_API sfSound* sfSound_create(const sfSoundBuffer* buffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new sound by copying an existing one
|
||||
@@ -51,7 +55,7 @@ CSFML_AUDIO_API sfSound* sfSound_create(void);
|
||||
/// \return A new sfSound object which is a copy of \a sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfSound* sfSound_copy(sfSound* sound);
|
||||
CSFML_AUDIO_API sfSound* sfSound_copy(const sfSound* sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destroy a sound
|
||||
@@ -59,7 +63,7 @@ CSFML_AUDIO_API sfSound* sfSound_copy(sfSound* sound);
|
||||
/// \param sound Sound to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSound_destroy(sfSound* sound);
|
||||
CSFML_AUDIO_API void sfSound_destroy(const sfSound* sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Start or resume playing a sound
|
||||
@@ -126,24 +130,24 @@ CSFML_AUDIO_API const sfSoundBuffer* sfSound_getBuffer(const sfSound* sound);
|
||||
///
|
||||
/// If set, the sound will restart from beginning after
|
||||
/// reaching the end and so on, until it is stopped or
|
||||
/// sfSound_setLoop(sound, sfFalse) is called.
|
||||
/// sfSound_setLooping(sound, false) is called.
|
||||
/// The default looping state for sounds is false.
|
||||
///
|
||||
/// \param sound Sound object
|
||||
/// \param loop sfTrue to play in loop, sfFalse to play once
|
||||
/// \param loop true to play in loop, false to play once
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSound_setLoop(sfSound* sound, sfBool loop);
|
||||
CSFML_AUDIO_API void sfSound_setLooping(sfSound* sound, bool loop);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether or not a soud is in loop mode
|
||||
/// \brief Tell whether or not a sound is in loop mode
|
||||
///
|
||||
/// \param sound Sound object
|
||||
///
|
||||
/// \return sfTrue if the sound is looping, sfFalse otherwise
|
||||
/// \return true if the sound is looping, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfBool sfSound_getLoop(const sfSound* sound);
|
||||
CSFML_AUDIO_API bool sfSound_isLooping(const sfSound* sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current status of a sound (stopped, paused, playing)
|
||||
@@ -170,6 +174,21 @@ CSFML_AUDIO_API sfSoundStatus sfSound_getStatus(const sfSound* sound);
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSound_setPitch(sfSound* sound, float pitch);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the pan of the sound
|
||||
///
|
||||
/// Using panning, a mono sound can be panned between
|
||||
/// stereo channels. When the pan is set to -1, the sound
|
||||
/// is played only on the left channel, when the pan is set
|
||||
/// to +1, the sound is played only on the right channel.
|
||||
///
|
||||
/// \param sound Sound object
|
||||
/// \param pan New pan to apply to the sound [-1, +1]
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSound_setPan(sfSound* sound, float pan);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the volume of a sound
|
||||
///
|
||||
@@ -182,6 +201,20 @@ CSFML_AUDIO_API void sfSound_setPitch(sfSound* sound, float pitch);
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSound_setVolume(sfSound* sound, float volume);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set whether spatialization of the sound is enabled
|
||||
///
|
||||
/// Spatialization is the application of various effects to
|
||||
/// simulate a sound being emitted at a virtual position in
|
||||
/// 3D space and exhibiting various physical phenomena such as
|
||||
/// directional attenuation and doppler shift.
|
||||
///
|
||||
/// \param sound Sound object
|
||||
/// \param enabled `true` to enable spatialization, `false` to disable
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSound_setSpatializationEnabled(sfSound* sound, bool enabled);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the 3D position of a sound in the audio scene
|
||||
///
|
||||
@@ -195,6 +228,74 @@ CSFML_AUDIO_API void sfSound_setVolume(sfSound* sound, float volume);
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSound_setPosition(sfSound* sound, sfVector3f position);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the 3D direction of the sound in the audio scene
|
||||
///
|
||||
/// The direction defines where the sound source is facing
|
||||
/// in 3D space. It will affect how the sound is attenuated
|
||||
/// if facing away from the listener.
|
||||
/// The default direction of a sound is (0, 0, -1).
|
||||
///
|
||||
/// \param sound Sound object
|
||||
/// \param direction Direction of the sound in the scene
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSound_setDirection(sfSound* sound, sfVector3f direction);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the cone properties of the sound in the audio scene
|
||||
///
|
||||
/// The cone defines how directional attenuation is applied.
|
||||
/// The default cone of a sound is (2 * PI, 2 * PI, 1).
|
||||
///
|
||||
/// \param sound Sound object
|
||||
/// \param cone Cone properties of the sound in the scene
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSound_setCone(sfSound* sound, sfSoundSourceCone cone);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the 3D velocity of the sound in the audio scene
|
||||
///
|
||||
/// The velocity is used to determine how to doppler shift
|
||||
/// the sound. Sounds moving towards the listener will be
|
||||
/// perceived to have a higher pitch and sounds moving away
|
||||
/// from the listener will be perceived to have a lower pitch.
|
||||
///
|
||||
/// \param sound Sound object
|
||||
/// \param velocity Velocity of the sound in the scene
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSound_setVelocity(sfSound* sound, sfVector3f velocity);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the doppler factor of the sound
|
||||
///
|
||||
/// The doppler factor determines how strong the doppler
|
||||
/// shift will be.
|
||||
///
|
||||
/// \param sound Sound object
|
||||
/// \param factor New doppler factor to apply to the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSound_setDopplerFactor(sfSound* sound, float factor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the directional attenuation factor of the sound
|
||||
///
|
||||
/// Depending on the virtual position of an output channel
|
||||
/// relative to the listener (such as in surround sound
|
||||
/// setups), sounds will be attenuated when emitting them
|
||||
/// from certain channels. This factor determines how strong
|
||||
/// the attenuation based on output channel position
|
||||
/// relative to the listener is.
|
||||
///
|
||||
/// \param sound Sound object
|
||||
/// \param factor New directional attenuation factor to apply to the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSound_setDirectionalAttenuationFactor(sfSound* sound, float factor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Make the sound's position relative to the listener or absolute
|
||||
///
|
||||
@@ -205,10 +306,10 @@ CSFML_AUDIO_API void sfSound_setPosition(sfSound* sound, sfVector3f position);
|
||||
/// The default value is false (position is absolute).
|
||||
///
|
||||
/// \param sound Sound object
|
||||
/// \param relative sfTrue to set the position relative, sfFalse to set it absolute
|
||||
/// \param relative true to set the position relative, false to set it absolute
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSound_setRelativeToListener(sfSound* sound, sfBool relative);
|
||||
CSFML_AUDIO_API void sfSound_setRelativeToListener(sfSound* sound, bool relative);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the minimum distance of a sound
|
||||
@@ -226,6 +327,49 @@ CSFML_AUDIO_API void sfSound_setRelativeToListener(sfSound* sound, sfBool relati
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSound_setMinDistance(sfSound* sound, float distance);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the maximum distance of the sound
|
||||
///
|
||||
/// The "maximum distance" of a sound is the minimum
|
||||
/// distance at which it is heard at its minimum volume. Closer
|
||||
/// than the maximum distance, it will start to fade in according
|
||||
/// to its attenuation factor.
|
||||
/// The default value of the maximum distance is the maximum
|
||||
/// value a float can represent.
|
||||
///
|
||||
/// \param sound Sound object
|
||||
/// \param distance New maximum distance of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSound_setMaxDistance(sfSound* sound, float distance);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the minimum gain of the sound
|
||||
///
|
||||
/// When the sound is further away from the listener than
|
||||
/// the "maximum distance" the attenuated gain is clamped
|
||||
/// so it cannot go below the minimum gain value.
|
||||
///
|
||||
/// \param sound Sound object
|
||||
/// \param gain New minimum gain of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSound_setMinGain(sfSound* sound, float gain);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the maximum gain of the sound
|
||||
///
|
||||
/// When the sound is closer from the listener than
|
||||
/// the "minimum distance" the attenuated gain is clamped
|
||||
/// so it cannot go above the maximum gain value.
|
||||
///
|
||||
///
|
||||
/// \param sound Sound object
|
||||
/// \param gain New maximum gain of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSound_setMaxGain(sfSound* sound, float gain);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the attenuation factor of a sound
|
||||
///
|
||||
@@ -256,6 +400,18 @@ CSFML_AUDIO_API void sfSound_setAttenuation(sfSound* sound, float attenuation);
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSound_setPlayingOffset(sfSound* sound, sfTime timeOffset);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the effect processor to be applied to the sound
|
||||
///
|
||||
/// The effect processor is a callable that will be called
|
||||
/// with sound data to be processed.
|
||||
///
|
||||
/// \param sound Sound object
|
||||
/// \param effectProcessor The effect processor to attach to this sound, attach an empty processor to disable processing
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSound_setEffectProcessor(sfSound* sound, sfEffectProcessor effectProcessor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the pitch of a sound
|
||||
///
|
||||
@@ -266,6 +422,16 @@ CSFML_AUDIO_API void sfSound_setPlayingOffset(sfSound* sound, sfTime timeOffset)
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API float sfSound_getPitch(const sfSound* sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the pan of the sound
|
||||
///
|
||||
/// \param sound Sound object
|
||||
///
|
||||
/// \return Pan of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API float sfSound_getPan(const sfSound* sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the volume of a sound
|
||||
///
|
||||
@@ -276,6 +442,16 @@ CSFML_AUDIO_API float sfSound_getPitch(const sfSound* sound);
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API float sfSound_getVolume(const sfSound* sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether spatialization of the sound is enabled
|
||||
///
|
||||
/// \param sound Sound object
|
||||
///
|
||||
/// \return `true` if spatialization is enabled, `false` if it's disabled
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API bool sfSound_isSpatializationEnabled(const sfSound* sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the 3D position of a sound in the audio scene
|
||||
///
|
||||
@@ -286,16 +462,66 @@ CSFML_AUDIO_API float sfSound_getVolume(const sfSound* sound);
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfVector3f sfSound_getPosition(const sfSound* sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the 3D direction of the sound in the audio scene
|
||||
///
|
||||
/// \param sound Sound object
|
||||
///
|
||||
/// \return Direction of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfVector3f sfSound_getDirection(const sfSound* sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the cone properties of the sound in the audio scene
|
||||
///
|
||||
/// \param sound Sound object
|
||||
///
|
||||
/// \return Cone properties of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfSoundSourceCone sfSound_getCone(const sfSound* sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the 3D velocity of the sound in the audio scene
|
||||
///
|
||||
/// \param sound Sound object
|
||||
///
|
||||
/// \return Velocity of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfVector3f sfSound_getVelocity(const sfSound* sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the doppler factor of the sound
|
||||
///
|
||||
/// \param sound Sound object
|
||||
///
|
||||
/// \return Doppler factor of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API float sfSound_getDopplerFactor(const sfSound* sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the directional attenuation factor of the sound
|
||||
///
|
||||
/// \param sound Sound object
|
||||
///
|
||||
/// \return Directional attenuation factor of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API float sfSound_getDirectionalAttenuationFactor(const sfSound* sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether a sound's position is relative to the
|
||||
/// listener or is absolute
|
||||
///
|
||||
/// \param sound Sound object
|
||||
///
|
||||
/// \return sfTrue if the position is relative, sfFalse if it's absolute
|
||||
/// \return true if the position is relative, false if it's absolute
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfBool sfSound_isRelativeToListener(const sfSound* sound);
|
||||
CSFML_AUDIO_API bool sfSound_isRelativeToListener(const sfSound* sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the minimum distance of a sound
|
||||
@@ -307,6 +533,36 @@ CSFML_AUDIO_API sfBool sfSound_isRelativeToListener(const sfSound* sound);
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API float sfSound_getMinDistance(const sfSound* sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the maximum distance of the sound
|
||||
///
|
||||
/// \param sound Sound object
|
||||
///
|
||||
/// \return Maximum distance of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API float sfSound_getMaxDistance(const sfSound* sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the minimum gain of the sound
|
||||
///
|
||||
/// \param sound Sound object
|
||||
///
|
||||
/// \return Minimum gain of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API float sfSound_getMinGain(const sfSound* sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the maximum gain of the sound
|
||||
///
|
||||
/// \param sound Sound object
|
||||
///
|
||||
/// \return Maximum gain of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API float sfSound_getMaxGain(const sfSound* sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the attenuation factor of a sound
|
||||
///
|
||||
@@ -326,6 +582,3 @@ CSFML_AUDIO_API float sfSound_getAttenuation(const sfSound* sound);
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfTime sfSound_getPlayingOffset(const sfSound* sound);
|
||||
|
||||
|
||||
#endif // SFML_SOUND_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,16 +22,18 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SOUNDBUFFER_H
|
||||
#define SFML_SOUNDBUFFER_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Audio/Export.h>
|
||||
#include <SFML/Audio/Types.h>
|
||||
#include <SFML/System/InputStream.h>
|
||||
#include <SFML/System/Time.h>
|
||||
#include <CSFML/Audio/Export.h>
|
||||
|
||||
#include <CSFML/Audio/SoundChannel.h>
|
||||
#include <CSFML/Audio/Types.h>
|
||||
#include <CSFML/System/InputStream.h>
|
||||
#include <CSFML/System/Time.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
@@ -39,7 +41,7 @@
|
||||
/// \brief Create a new sound buffer and load it from a file
|
||||
///
|
||||
/// Here is a complete list of all the supported audio formats:
|
||||
/// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam,
|
||||
/// ogg, wav, flac, mp3, aiff, au, raw, paf, svx, nist, voc, ircam,
|
||||
/// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
|
||||
///
|
||||
/// \param filename Path of the sound file to load
|
||||
@@ -53,7 +55,7 @@ CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromFile(const char* filename
|
||||
/// \brief Create a new sound buffer and load it from a file in memory
|
||||
///
|
||||
/// Here is a complete list of all the supported audio formats:
|
||||
/// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam,
|
||||
/// ogg, wav, flac, mp3, aiff, au, raw, paf, svx, nist, voc, ircam,
|
||||
/// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
|
||||
///
|
||||
/// \param data Pointer to the file data in memory
|
||||
@@ -68,7 +70,7 @@ CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromMemory(const void* data,
|
||||
/// \brief Create a new sound buffer and load it from a custom stream
|
||||
///
|
||||
/// Here is a complete list of all the supported audio formats:
|
||||
/// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam,
|
||||
/// ogg, wav, flac, mp3, aiff, au, raw, paf, svx, nist, voc, ircam,
|
||||
/// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
|
||||
///
|
||||
/// \param stream Source stream to read from
|
||||
@@ -82,17 +84,25 @@ CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromStream(sfInputStream* str
|
||||
/// \brief Create a new sound buffer and load it from an array of samples in memory
|
||||
///
|
||||
/// The assumed format of the audio samples is 16 bits signed integer
|
||||
/// (sfInt16).
|
||||
/// (int16_t).
|
||||
///
|
||||
/// \param samples Pointer to the array of samples in memory
|
||||
/// \param sampleCount Number of samples in the array
|
||||
/// \param channelCount Number of channels (1 = mono, 2 = stereo, ...)
|
||||
/// \param sampleRate Sample rate (number of samples to play per second)
|
||||
/// \param samples Pointer to the array of samples in memory
|
||||
/// \param sampleCount Number of samples in the array
|
||||
/// \param channelCount Number of channels (1 = mono, 2 = stereo, ...)
|
||||
/// \param sampleRate Sample rate (number of samples to play per second)
|
||||
/// \param channelMapData Pointer to the array of channel map data
|
||||
/// \param channelMapSize Size of channel map data array
|
||||
///
|
||||
/// \return A new sfSoundBuffer object (NULL if failed)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromSamples(const sfInt16* samples, size_t sampleCount, unsigned int channelCount, unsigned int sampleRate);
|
||||
CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromSamples(
|
||||
const int16_t* samples,
|
||||
uint64_t sampleCount,
|
||||
unsigned int channelCount,
|
||||
unsigned int sampleRate,
|
||||
sfSoundChannel* channelMapData,
|
||||
size_t channelMapSize);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new sound buffer by copying an existing one
|
||||
@@ -102,7 +112,7 @@ CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromSamples(const sfInt16* sa
|
||||
/// \return A new sfSoundBuffer object which is a copy of \a soundBuffer
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_copy(sfSoundBuffer* soundBuffer);
|
||||
CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_copy(const sfSoundBuffer* soundBuffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destroy a sound buffer
|
||||
@@ -110,36 +120,36 @@ CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_copy(sfSoundBuffer* soundBuffer);
|
||||
/// \param soundBuffer Sound buffer to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSoundBuffer_destroy(sfSoundBuffer* soundBuffer);
|
||||
CSFML_AUDIO_API void sfSoundBuffer_destroy(const sfSoundBuffer* soundBuffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Save a sound buffer to an audio file
|
||||
///
|
||||
/// Here is a complete list of all the supported audio formats:
|
||||
/// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam,
|
||||
/// ogg, wav, flac, mp3, aiff, au, raw, paf, svx, nist, voc, ircam,
|
||||
/// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
|
||||
///
|
||||
/// \param soundBuffer Sound buffer object
|
||||
/// \param filename Path of the sound file to write
|
||||
///
|
||||
/// \return sfTrue if saving succeeded, sfFalse if it failed
|
||||
/// \return true if saving succeeded, false if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfBool sfSoundBuffer_saveToFile(const sfSoundBuffer* soundBuffer, const char* filename);
|
||||
CSFML_AUDIO_API bool sfSoundBuffer_saveToFile(const sfSoundBuffer* soundBuffer, const char* filename);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the array of audio samples stored in a sound buffer
|
||||
///
|
||||
/// The format of the returned samples is 16 bits signed integer
|
||||
/// (sfInt16). The total number of samples in this array
|
||||
/// is given by the sfSoundBuffer_GetSampleCount function.
|
||||
/// (int16_t). The total number of samples in this array
|
||||
/// is given by the sfSoundBuffer_getSampleCount function.
|
||||
///
|
||||
/// \param soundBuffer Sound buffer object
|
||||
///
|
||||
/// \return Read-only pointer to the array of sound samples
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API const sfInt16* sfSoundBuffer_getSamples(const sfSoundBuffer* soundBuffer);
|
||||
CSFML_AUDIO_API const int16_t* sfSoundBuffer_getSamples(const sfSoundBuffer* soundBuffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the number of samples stored in a sound buffer
|
||||
@@ -152,7 +162,7 @@ CSFML_AUDIO_API const sfInt16* sfSoundBuffer_getSamples(const sfSoundBuffer* sou
|
||||
/// \return Number of samples
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API size_t sfSoundBuffer_getSampleCount(const sfSoundBuffer* soundBuffer);
|
||||
CSFML_AUDIO_API uint64_t sfSoundBuffer_getSampleCount(const sfSoundBuffer* soundBuffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the sample rate of a sound buffer
|
||||
@@ -181,6 +191,20 @@ CSFML_AUDIO_API unsigned int sfSoundBuffer_getSampleRate(const sfSoundBuffer* so
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API unsigned int sfSoundBuffer_getChannelCount(const sfSoundBuffer* soundBuffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the map of position in sample frame to sound channel
|
||||
///
|
||||
/// This is used to map a sample in the sample stream to a
|
||||
/// position during spatialization.
|
||||
///
|
||||
/// \param soundBuffer Sound buffer object
|
||||
/// \param count Pointer to a variable that will be filled with the number of channels in the map
|
||||
///
|
||||
/// \return Map of position in sample frame to sound channel
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfSoundChannel* sfSoundBuffer_getChannelMap(const sfSoundBuffer* soundBuffer, size_t* count);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the total duration of a sound buffer
|
||||
///
|
||||
@@ -190,6 +214,3 @@ CSFML_AUDIO_API unsigned int sfSoundBuffer_getChannelCount(const sfSoundBuffer*
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfTime sfSoundBuffer_getDuration(const sfSoundBuffer* soundBuffer);
|
||||
|
||||
|
||||
#endif // SFML_SOUNDBUFFER_H
|
||||
+65
-8
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,14 +22,14 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SOUNDBUFFERRECORDER_H
|
||||
#define SFML_SOUNDBUFFERRECORDER_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Audio/Export.h>
|
||||
#include <SFML/Audio/Types.h>
|
||||
#include <CSFML/Audio/Export.h>
|
||||
|
||||
#include <CSFML/Audio/Types.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -46,7 +46,7 @@ CSFML_AUDIO_API sfSoundBufferRecorder* sfSoundBufferRecorder_create(void);
|
||||
/// \param soundBufferRecorder Sound buffer recorder to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSoundBufferRecorder_destroy(sfSoundBufferRecorder* soundBufferRecorder);
|
||||
CSFML_AUDIO_API void sfSoundBufferRecorder_destroy(const sfSoundBufferRecorder* soundBufferRecorder);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Start the capture of a sound recorder recorder
|
||||
@@ -61,8 +61,10 @@ CSFML_AUDIO_API void sfSoundBufferRecorder_destroy(sfSoundBufferRecorder* soundB
|
||||
/// \param soundBufferRecorder Sound buffer recorder object
|
||||
/// \param sampleRate Desired capture rate, in number of samples per second
|
||||
///
|
||||
/// \return true, if it was able to start recording
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSoundBufferRecorder_start(sfSoundBufferRecorder* soundBufferRecorder, unsigned int sampleRate);
|
||||
CSFML_AUDIO_API bool sfSoundBufferRecorder_start(sfSoundBufferRecorder* soundBufferRecorder, unsigned int sampleRate);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Stop the capture of a sound recorder
|
||||
@@ -101,5 +103,60 @@ CSFML_AUDIO_API unsigned int sfSoundBufferRecorder_getSampleRate(const sfSoundBu
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API const sfSoundBuffer* sfSoundBufferRecorder_getBuffer(const sfSoundBufferRecorder* soundBufferRecorder);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the audio capture device
|
||||
///
|
||||
/// This function sets the audio capture device to the device
|
||||
/// with the given name. It can be called on the fly (i.e:
|
||||
/// while recording). If you do so while recording and
|
||||
/// opening the device fails, it stops the recording.
|
||||
///
|
||||
/// \param soundBufferRecorder Sound buffer recorder object
|
||||
/// \param name The name of the audio capture device
|
||||
///
|
||||
/// \return true, if it was able to set the requested device
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API bool sfSoundBufferRecorder_setDevice(sfSoundBufferRecorder* soundBufferRecorder, const char* name);
|
||||
|
||||
#endif // SFML_SOUNDBUFFERRECORDER_H
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the name of the current audio capture device
|
||||
///
|
||||
/// \param soundBufferRecorder Sound buffer recorder object
|
||||
///
|
||||
/// \return The name of the current audio capture device
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API const char* sfSoundBufferRecorder_getDevice(sfSoundBufferRecorder* soundBufferRecorder);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the channel count of the audio capture device
|
||||
///
|
||||
/// This method allows you to specify the number of channels
|
||||
/// used for recording. Currently only 16-bit mono and
|
||||
/// 16-bit stereo are supported.
|
||||
///
|
||||
/// \param soundBufferRecorder Sound buffer recorder object
|
||||
/// \param channelCount Number of channels. Currently only
|
||||
/// mono (1) and stereo (2) are supported.
|
||||
///
|
||||
/// \see sfSoundBufferRecorder_getChannelCount
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSoundBufferRecorder_setChannelCount(sfSoundBufferRecorder* soundBufferRecorder,
|
||||
unsigned int channelCount);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the number of channels used by this recorder
|
||||
///
|
||||
/// Currently only mono and stereo are supported, so the
|
||||
/// value is either 1 (for mono) or 2 (for stereo).
|
||||
///
|
||||
/// \param soundBufferRecorder Sound buffer recorder object
|
||||
///
|
||||
/// \return Number of channels
|
||||
///
|
||||
/// \see sfSoundBufferRecorder_setChannelCount
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API unsigned int sfSoundBufferRecorder_getChannelCount(const sfSoundBufferRecorder* soundBufferRecorder);
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,26 +22,39 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_BLENDMODE_H
|
||||
#define SFML_BLENDMODE_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Graphics/Export.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Available blending modes for drawing
|
||||
/// \brief Types of sound channels that can be read/written from sound buffers/files
|
||||
///
|
||||
/// In multi-channel audio, each sound channel can be
|
||||
/// assigned a position. The position of the channel is
|
||||
/// used to determine where to place a sound when it
|
||||
/// is spatialised. Assigning an incorrect sound channel
|
||||
/// will result in multi-channel audio being positioned
|
||||
/// incorrectly when using spatialisation.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef enum
|
||||
typedef enum
|
||||
{
|
||||
sfBlendAlpha, ///< Pixel = Src * a + Dest * (1 - a)
|
||||
sfBlendAdd, ///< Pixel = Src + Dest
|
||||
sfBlendMultiply, ///< Pixel = Src * Dest
|
||||
sfBlendNone ///< No blending
|
||||
} sfBlendMode;
|
||||
|
||||
|
||||
#endif // SFML_BLENDMODE_H
|
||||
sfSoundChannelUnspecified,
|
||||
sfSoundChannelMono,
|
||||
sfSoundChannelFrontLeft,
|
||||
sfSoundChannelFrontRight,
|
||||
sfSoundChannelFrontCenter,
|
||||
sfSoundChannelFrontLeftOfCenter,
|
||||
sfSoundChannelFrontRightOfCenter,
|
||||
sfSoundChannelLowFrequencyEffects,
|
||||
sfSoundChannelBackLeft,
|
||||
sfSoundChannelBackRight,
|
||||
sfSoundChannelBackCenter,
|
||||
sfSoundChannelSideLeft,
|
||||
sfSoundChannelSideRight,
|
||||
sfSoundChannelTopCenter,
|
||||
sfSoundChannelTopFrontLeft,
|
||||
sfSoundChannelTopFrontRight,
|
||||
sfSoundChannelTopFrontCenter,
|
||||
sfSoundChannelTopBackLeft,
|
||||
sfSoundChannelTopBackRight,
|
||||
sfSoundChannelTopBackCenter
|
||||
} sfSoundChannel;
|
||||
@@ -0,0 +1,212 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <CSFML/Audio/Export.h>
|
||||
|
||||
#include <CSFML/Audio/SoundChannel.h>
|
||||
#include <CSFML/Audio/Types.h>
|
||||
#include <CSFML/System/Time.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
typedef bool (*sfSoundRecorderStartCallback)(void*); ///< Type of the callback used when starting a capture
|
||||
typedef bool (*sfSoundRecorderProcessCallback)(const int16_t*, size_t, void*); ///< Type of the callback used to process audio data
|
||||
typedef void (*sfSoundRecorderStopCallback)(void*); ///< Type of the callback used when stopping a capture
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Construct a new sound recorder from callback functions
|
||||
///
|
||||
/// \param onStart Callback function which will be called when a new capture starts (can be NULL)
|
||||
/// \param onProcess Callback function which will be called each time there's audio data to process
|
||||
/// \param onStop Callback function which will be called when the current capture stops (can be NULL)
|
||||
/// \param userData Data to pass to the callback function (can be NULL)
|
||||
///
|
||||
/// \return A new sfSoundRecorder object (NULL if failed)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfSoundRecorder* sfSoundRecorder_create(sfSoundRecorderStartCallback onStart,
|
||||
sfSoundRecorderProcessCallback onProcess,
|
||||
sfSoundRecorderStopCallback onStop,
|
||||
void* userData);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destroy a sound recorder
|
||||
///
|
||||
/// \param soundRecorder Sound recorder to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSoundRecorder_destroy(const sfSoundRecorder* soundRecorder);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Start the capture of a sound recorder
|
||||
///
|
||||
/// The \a sampleRate parameter defines the number of audio samples
|
||||
/// captured per second. The higher, the better the quality
|
||||
/// (for example, 44100 samples/sec is CD quality).
|
||||
/// This function uses its own thread so that it doesn't block
|
||||
/// the rest of the program while the capture runs.
|
||||
/// Please note that only one capture can happen at the same time.
|
||||
///
|
||||
/// \param soundRecorder Sound recorder object
|
||||
/// \param sampleRate Desired capture rate, in number of samples per second
|
||||
///
|
||||
/// \return True, if start of capture was successful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API bool sfSoundRecorder_start(sfSoundRecorder* soundRecorder, unsigned int sampleRate);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Stop the capture of a sound recorder
|
||||
///
|
||||
/// \param soundRecorder Sound recorder object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSoundRecorder_stop(sfSoundRecorder* soundRecorder);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the sample rate of a sound recorder
|
||||
///
|
||||
/// The sample rate defines the number of audio samples
|
||||
/// captured per second. The higher, the better the quality
|
||||
/// (for example, 44100 samples/sec is CD quality).
|
||||
///
|
||||
/// \param soundRecorder Sound recorder object
|
||||
///
|
||||
/// \return Sample rate, in samples per second
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API unsigned int sfSoundRecorder_getSampleRate(const sfSoundRecorder* soundRecorder);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check if the system supports audio capture
|
||||
///
|
||||
/// This function should always be called before using
|
||||
/// the audio capture features. If it returns false, then
|
||||
/// any attempt to use sfSoundRecorder will fail.
|
||||
///
|
||||
/// \return true if audio capture is supported, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API bool sfSoundRecorder_isAvailable(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get a list of the names of all available audio capture devices
|
||||
///
|
||||
/// This function returns an array of strings (null terminated),
|
||||
/// containing the names of all available audio capture devices.
|
||||
/// If no devices are available, then NULL is returned.
|
||||
///
|
||||
/// \param count Pointer to a variable that will be filled with the number of modes in the array
|
||||
///
|
||||
/// \return An array of strings containing the names
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API const char* const* sfSoundRecorder_getAvailableDevices(size_t* count);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the name of the default audio capture device
|
||||
///
|
||||
/// This function returns the name of the default audio
|
||||
/// capture device. If none is available, NULL is returned.
|
||||
///
|
||||
/// \return The name of the default audio capture device (null terminated)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API const char* sfSoundRecorder_getDefaultDevice(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the audio capture device
|
||||
///
|
||||
/// This function sets the audio capture device to the device
|
||||
/// with the given name. It can be called on the fly (i.e:
|
||||
/// while recording). If you do so while recording and
|
||||
/// opening the device fails, it stops the recording.
|
||||
///
|
||||
/// \param soundRecorder Sound recorder object
|
||||
/// \param name The name of the audio capture device
|
||||
///
|
||||
/// \return true, if it was able to set the requested device
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API bool sfSoundRecorder_setDevice(sfSoundRecorder* soundRecorder, const char* name);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the name of the current audio capture device
|
||||
///
|
||||
/// \param soundRecorder Sound recorder object
|
||||
///
|
||||
/// \return The name of the current audio capture device
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API const char* sfSoundRecorder_getDevice(sfSoundRecorder* soundRecorder);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the channel count of the audio capture device
|
||||
///
|
||||
/// This method allows you to specify the number of channels
|
||||
/// used for recording. Currently only 16-bit mono and
|
||||
/// 16-bit stereo are supported.
|
||||
///
|
||||
/// \param soundRecorder Sound recorder object
|
||||
/// \param channelCount Number of channels. Currently only
|
||||
/// mono (1) and stereo (2) are supported.
|
||||
///
|
||||
/// \see sfSoundRecorder_getChannelCount
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSoundRecorder_setChannelCount(sfSoundRecorder* soundRecorder, unsigned int channelCount);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the number of channels used by this recorder
|
||||
///
|
||||
/// Currently only mono and stereo are supported, so the
|
||||
/// value is either 1 (for mono) or 2 (for stereo).
|
||||
///
|
||||
/// \return Number of channels
|
||||
///
|
||||
/// \see sfSoundRecorder_setChannelCount
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API unsigned int sfSoundRecorder_getChannelCount(const sfSoundRecorder* soundRecorder);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the map of position in sample frame to sound channel
|
||||
///
|
||||
/// This is used to map a sample in the sample stream to a
|
||||
/// position during spatialization.
|
||||
///
|
||||
/// \param soundRecorder Sound recorder object
|
||||
/// \param count Pointer to a variable that will be filled with the number of channels in the map
|
||||
///
|
||||
/// \return Map of position in sample frame to sound channel
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfSoundChannel* sfSoundRecorder_getChannelMap(const sfSoundRecorder* soundRecorder, size_t* count);
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,28 +22,22 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_RENDERSTATES_H
|
||||
#define SFML_RENDERSTATES_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Graphics/Export.h>
|
||||
#include <SFML/Graphics/BlendMode.h>
|
||||
#include <SFML/Graphics/Types.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Define the states used for drawing to a RenderTarget
|
||||
/// \brief Structure defining the properties of a directional cone
|
||||
///
|
||||
/// Sounds will play at gain 1 when the listener
|
||||
/// is positioned within the inner angle of the cone.
|
||||
/// Sounds will play at `outerGain` when the listener is
|
||||
/// positioned outside the outer angle of the cone.
|
||||
/// The gain declines linearly from 1 to `outerGain` as the
|
||||
/// listener moves from the inner angle to the outer angle.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
sfBlendMode blendMode; ///< Blending mode
|
||||
sfTransform* transform; ///< Transform
|
||||
const sfTexture* texture; ///< Texture
|
||||
const sfShader* shader; ///< Shader
|
||||
} sfRenderStates;
|
||||
|
||||
|
||||
#endif // SFML_RENDERSTATES_H
|
||||
float innerAngle; //!< Inner angle, in degrees
|
||||
float outerAngle; //!< Outer angle, in degrees
|
||||
float outerGain; //!< Outer gain
|
||||
} sfSoundSourceCone;
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,13 +22,12 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SOUNDSTATUS_H
|
||||
#define SFML_SOUNDSTATUS_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Audio/Export.h>
|
||||
#include <CSFML/Audio/Export.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -41,6 +40,3 @@ typedef enum
|
||||
sfPaused, ///< Sound / music is paused
|
||||
sfPlaying ///< Sound / music is playing
|
||||
} sfSoundStatus;
|
||||
|
||||
|
||||
#endif // SFML_SOUNDSTATUS_H
|
||||
@@ -0,0 +1,618 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <CSFML/Audio/Export.h>
|
||||
|
||||
#include <CSFML/Audio/EffectProcessor.h>
|
||||
#include <CSFML/Audio/SoundChannel.h>
|
||||
#include <CSFML/Audio/SoundSourceCone.h>
|
||||
#include <CSFML/Audio/SoundStatus.h>
|
||||
#include <CSFML/Audio/Types.h>
|
||||
#include <CSFML/System/Time.h>
|
||||
#include <CSFML/System/Vector3.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief defines the data to fill by the OnGetData callback
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
int16_t* samples; ///< Pointer to the audio samples
|
||||
unsigned int sampleCount; ///< Number of samples pointed by Samples
|
||||
} sfSoundStreamChunk;
|
||||
|
||||
typedef bool (*sfSoundStreamGetDataCallback)(sfSoundStreamChunk*, void*); ///< Type of the callback used to get a sound stream data
|
||||
typedef void (*sfSoundStreamSeekCallback)(sfTime, void*); ///< Type of the callback used to seek in a sound stream
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new sound stream
|
||||
///
|
||||
/// \param onGetData Function called when the stream needs more data (can't be NULL)
|
||||
/// \param onSeek Function called when the stream seeks (can't be NULL)
|
||||
/// \param channelCount Number of channels to use (1 = mono, 2 = stereo)
|
||||
/// \param sampleRate Sample rate of the sound (44100 = CD quality)
|
||||
/// \param channelMapData Pointer to the array of channel map data
|
||||
/// \param channelMapSize Size of channel map data array
|
||||
/// \param userData Data to pass to the callback functions
|
||||
///
|
||||
/// \return A new sfSoundStream object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfSoundStream* sfSoundStream_create(
|
||||
sfSoundStreamGetDataCallback onGetData,
|
||||
sfSoundStreamSeekCallback onSeek,
|
||||
unsigned int channelCount,
|
||||
unsigned int sampleRate,
|
||||
sfSoundChannel* channelMapData,
|
||||
size_t channelMapSize,
|
||||
void* userData);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destroy a sound stream
|
||||
///
|
||||
/// \param soundStream Sound stream to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSoundStream_destroy(const sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Start or resume playing a sound stream
|
||||
///
|
||||
/// This function starts the stream if it was stopped, resumes
|
||||
/// it if it was paused, and restarts it from beginning if it
|
||||
/// was it already playing.
|
||||
/// This function uses its own thread so that it doesn't block
|
||||
/// the rest of the program while the music is played.
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSoundStream_play(sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Pause a sound stream
|
||||
///
|
||||
/// This function pauses the stream if it was playing,
|
||||
/// otherwise (stream already paused or stopped) it has no effect.
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSoundStream_pause(sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Stop playing a sound stream
|
||||
///
|
||||
/// This function stops the stream if it was playing or paused,
|
||||
/// and does nothing if it was already stopped.
|
||||
/// It also resets the playing position (unlike sfSoundStream_pause).
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSoundStream_stop(sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current status of a sound stream (stopped, paused, playing)
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
///
|
||||
/// \return Current status
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfSoundStatus sfSoundStream_getStatus(const sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return the number of channels of a sound stream
|
||||
///
|
||||
/// 1 channel means a mono sound, 2 means stereo, etc.
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
///
|
||||
/// \return Number of channels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API unsigned int sfSoundStream_getChannelCount(const sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the sample rate of a sound stream
|
||||
///
|
||||
/// The sample rate is the number of audio samples played per
|
||||
/// second. The higher, the better the quality.
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
///
|
||||
/// \return Sample rate, in number of samples per second
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API unsigned int sfSoundStream_getSampleRate(const sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the map of position in sample frame to sound channel
|
||||
///
|
||||
/// This is used to map a sample in the sample stream to a
|
||||
/// position during spatialization.
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
/// \param count Pointer to a variable that will be filled with the number of channels in the map
|
||||
///
|
||||
/// \return Map of position in sample frame to sound channel
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfSoundChannel* sfSoundStream_getChannelMap(const sfSoundStream* soundStream, size_t* count);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the pitch of a sound stream
|
||||
///
|
||||
/// The pitch represents the perceived fundamental frequency
|
||||
/// of a sound; thus you can make a stream more acute or grave
|
||||
/// by changing its pitch. A side effect of changing the pitch
|
||||
/// is to modify the playing speed of the stream as well.
|
||||
/// The default value for the pitch is 1.
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
/// \param pitch New pitch to apply to the stream
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSoundStream_setPitch(sfSoundStream* soundStream, float pitch);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the pan of the sound
|
||||
///
|
||||
/// Using panning, a mono sound can be panned between
|
||||
/// stereo channels. When the pan is set to -1, the sound
|
||||
/// is played only on the left channel, when the pan is set
|
||||
/// to +1, the sound is played only on the right channel.
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
/// \param pan New pan to apply to the sound [-1, +1]
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSoundStream_setPan(sfSoundStream* soundStream, float pan);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the volume of a sound stream
|
||||
///
|
||||
/// The volume is a value between 0 (mute) and 100 (full volume).
|
||||
/// The default value for the volume is 100.
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
/// \param volume Volume of the stream
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSoundStream_setVolume(sfSoundStream* soundStream, float volume);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set whether spatialization of the sound is enabled
|
||||
///
|
||||
/// Spatialization is the application of various effects to
|
||||
/// simulate a sound being emitted at a virtual position in
|
||||
/// 3D space and exhibiting various physical phenomena such as
|
||||
/// directional attenuation and doppler shift.
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
/// \param enabled `true` to enable spatialization, `false` to disable
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSoundStream_setSpatializationEnabled(sfSoundStream* soundStream, bool enabled);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the 3D position of a sound stream in the audio scene
|
||||
///
|
||||
/// Only streams with one channel (mono streams) can be
|
||||
/// spatialized.
|
||||
/// The default position of a stream is (0, 0, 0).
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
/// \param position Position of the stream in the scene
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSoundStream_setPosition(sfSoundStream* soundStream, sfVector3f position);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the 3D direction of the sound in the audio scene
|
||||
///
|
||||
/// The direction defines where the sound source is facing
|
||||
/// in 3D space. It will affect how the sound is attenuated
|
||||
/// if facing away from the listener.
|
||||
/// The default direction of a sound is (0, 0, -1).
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
/// \param direction Direction of the sound in the scene
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSoundStream_setDirection(sfSoundStream* soundStream, sfVector3f direction);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the cone properties of the sound in the audio scene
|
||||
///
|
||||
/// The cone defines how directional attenuation is applied.
|
||||
/// The default cone of a sound is (2 * PI, 2 * PI, 1).
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
/// \param cone Cone properties of the sound in the scene
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSoundStream_setCone(sfSoundStream* soundStream, sfSoundSourceCone cone);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the 3D velocity of the sound in the audio scene
|
||||
///
|
||||
/// The velocity is used to determine how to doppler shift
|
||||
/// the sound. Sounds moving towards the listener will be
|
||||
/// perceived to have a higher pitch and sounds moving away
|
||||
/// from the listener will be perceived to have a lower pitch.
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
/// \param velocity Velocity of the sound in the scene
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSoundStream_setVelocity(sfSoundStream* soundStream, sfVector3f velocity);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the doppler factor of the sound
|
||||
///
|
||||
/// The doppler factor determines how strong the doppler
|
||||
/// shift will be.
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
/// \param factor New doppler factor to apply to the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSoundStream_setDopplerFactor(sfSoundStream* soundStream, float factor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the directional attenuation factor of the sound
|
||||
///
|
||||
/// Depending on the virtual position of an output channel
|
||||
/// relative to the listener (such as in surround sound
|
||||
/// setups), sounds will be attenuated when emitting them
|
||||
/// from certain channels. This factor determines how strong
|
||||
/// the attenuation based on output channel position
|
||||
/// relative to the listener is.
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
/// \param factor New directional attenuation factor to apply to the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSoundStream_setDirectionalAttenuationFactor(sfSoundStream* soundStream, float factor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Make a sound stream's position relative to the listener or absolute
|
||||
///
|
||||
/// Making a stream relative to the listener will ensure that it will always
|
||||
/// be played the same way regardless the position of the listener.
|
||||
/// This can be useful for non-spatialized streams, streams that are
|
||||
/// produced by the listener, or streams attached to it.
|
||||
/// The default value is false (position is absolute).
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
/// \param relative true to set the position relative, false to set it absolute
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSoundStream_setRelativeToListener(sfSoundStream* soundStream, bool relative);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the minimum distance of a sound stream
|
||||
///
|
||||
/// The "minimum distance" of a stream is the maximum
|
||||
/// distance at which it is heard at its maximum volume. Further
|
||||
/// than the minimum distance, it will start to fade out according
|
||||
/// to its attenuation factor. A value of 0 ("inside the head
|
||||
/// of the listener") is an invalid value and is forbidden.
|
||||
/// The default value of the minimum distance is 1.
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
/// \param distance New minimum distance of the stream
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSoundStream_setMinDistance(sfSoundStream* soundStream, float distance);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the maximum distance of the sound
|
||||
///
|
||||
/// The "maximum distance" of a sound is the minimum
|
||||
/// distance at which it is heard at its minimum volume. Closer
|
||||
/// than the maximum distance, it will start to fade in according
|
||||
/// to its attenuation factor.
|
||||
/// The default value of the maximum distance is the maximum
|
||||
/// value a float can represent.
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
/// \param distance New maximum distance of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSoundStream_setMaxDistance(sfSoundStream* soundStream, float distance);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the minimum gain of the sound
|
||||
///
|
||||
/// When the sound is further away from the listener than
|
||||
/// the "maximum distance" the attenuated gain is clamped
|
||||
/// so it cannot go below the minimum gain value.
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
/// \param gain New minimum gain of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSoundStream_setMinGain(sfSoundStream* soundStream, float gain);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the maximum gain of the sound
|
||||
///
|
||||
/// When the sound is closer from the listener than
|
||||
/// the "minimum distance" the attenuated gain is clamped
|
||||
/// so it cannot go above the maximum gain value.
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
/// \param gain New maximum gain of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSoundStream_setMaxGain(sfSoundStream* soundStream, float gain);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the attenuation factor of a sound stream
|
||||
///
|
||||
/// The attenuation is a multiplicative factor which makes
|
||||
/// the stream more or less loud according to its distance
|
||||
/// from the listener. An attenuation of 0 will produce a
|
||||
/// non-attenuated stream, i.e. its volume will always be the same
|
||||
/// whether it is heard from near or from far. On the other hand,
|
||||
/// an attenuation value such as 100 will make the stream fade out
|
||||
/// very quickly as it gets further from the listener.
|
||||
/// The default value of the attenuation is 1.
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
/// \param attenuation New attenuation factor of the stream
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSoundStream_setAttenuation(sfSoundStream* soundStream, float attenuation);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change the current playing position of a sound stream
|
||||
///
|
||||
/// The playing position can be changed when the stream is
|
||||
/// either paused or playing.
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
/// \param timeOffset New playing position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSoundStream_setPlayingOffset(sfSoundStream* soundStream, sfTime timeOffset);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set whether or not a sound stream should loop after reaching the end
|
||||
///
|
||||
/// If set, the stream will restart from beginning after
|
||||
/// reaching the end and so on, until it is stopped or
|
||||
/// sfSoundStream_setLooping(stream, false) is called.
|
||||
/// The default looping state for sound streams is false.
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
/// \param loop true to play in loop, false to play once
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSoundStream_setLooping(sfSoundStream* soundStream, bool loop);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the pitch of a sound stream
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
///
|
||||
/// \return Pitch of the stream
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API float sfSoundStream_getPitch(const sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the pan of the sound
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
///
|
||||
/// \return Pan of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API float sfSoundStream_getPan(const sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the volume of a sound stream
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
///
|
||||
/// \return Volume of the stream, in the range [0, 100]
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API float sfSoundStream_getVolume(const sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether spatialization of the sound is enabled
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
///
|
||||
/// \return `true` if spatialization is enabled, `false` if it's disabled
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API bool sfSoundStream_isSpatializationEnabled(const sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the 3D position of a sound stream in the audio scene
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
///
|
||||
/// \return Position of the stream in the world
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfVector3f sfSoundStream_getPosition(const sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the 3D direction of the sound in the audio scene
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
///
|
||||
/// \return Direction of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfVector3f sfSoundStream_getDirection(const sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the cone properties of the sound in the audio scene
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
///
|
||||
/// \return Cone properties of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfSoundSourceCone sfSoundStream_getCone(const sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the 3D velocity of the sound in the audio scene
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
///
|
||||
/// \return Velocity of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfVector3f sfSoundStream_getVelocity(const sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the doppler factor of the sound
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
///
|
||||
/// \return Doppler factor of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API float sfSoundStream_getDopplerFactor(const sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the directional attenuation factor of the sound
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
///
|
||||
/// \return Directional attenuation factor of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API float sfSoundStream_getDirectionalAttenuationFactor(const sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether a sound stream's position is relative to the
|
||||
/// listener or is absolute
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
///
|
||||
/// \return true if the position is relative, false if it's absolute
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API bool sfSoundStream_isRelativeToListener(const sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the minimum distance of a sound stream
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
///
|
||||
/// \return Minimum distance of the stream
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API float sfSoundStream_getMinDistance(const sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the maximum distance of the sound
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
///
|
||||
/// \return Maximum distance of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API float sfSoundStream_getMaxDistance(const sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the minimum gain of the sound
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
///
|
||||
/// \return Minimum gain of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API float sfSoundStream_getMinGain(const sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the maximum gain of the sound
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
///
|
||||
/// \return Maximum gain of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API float sfSoundStream_getMaxGain(const sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the attenuation factor of a sound stream
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
///
|
||||
/// \return Attenuation factor of the stream
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API float sfSoundStream_getAttenuation(const sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether or not a sound stream is in loop mode
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
///
|
||||
/// \return true if the music is looping, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API bool sfSoundStream_isLooping(const sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the effect processor to be applied to the sound
|
||||
///
|
||||
/// The effect processor is a callable that will be called
|
||||
/// with sound data to be processed.
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
/// \param effectProcessor The effect processor to attach to this sound, attach an empty processor to disable processing
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSoundStream_setEffectProcessor(sfSoundStream* soundStream, sfEffectProcessor effectProcessor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current playing position of a sound stream
|
||||
///
|
||||
/// \param soundStream Sound stream object
|
||||
///
|
||||
/// \return Current playing position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfTime sfSoundStream_getPlayingOffset(const sfSoundStream* soundStream);
|
||||
@@ -1,7 +1,8 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)//
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
@@ -21,16 +22,11 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_AUDIO_TYPES_H
|
||||
#define SFML_AUDIO_TYPES_H
|
||||
#pragma once
|
||||
|
||||
|
||||
typedef struct sfMusic sfMusic;
|
||||
typedef struct sfSound sfSound;
|
||||
typedef struct sfSoundBuffer sfSoundBuffer;
|
||||
typedef struct sfMusic sfMusic;
|
||||
typedef struct sfSound sfSound;
|
||||
typedef struct sfSoundBuffer sfSoundBuffer;
|
||||
typedef struct sfSoundBufferRecorder sfSoundBufferRecorder;
|
||||
typedef struct sfSoundRecorder sfSoundRecorder;
|
||||
typedef struct sfSoundStream sfSoundStream;
|
||||
|
||||
|
||||
#endif // SFML_AUDIO_TYPES_H
|
||||
typedef struct sfSoundRecorder sfSoundRecorder;
|
||||
typedef struct sfSoundStream sfSoundStream;
|
||||
@@ -0,0 +1,161 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Define the CSFML version
|
||||
////////////////////////////////////////////////////////////
|
||||
#define CSFML_VERSION_MAJOR 3
|
||||
#define CSFML_VERSION_MINOR 0
|
||||
#define CSFML_VERSION_PATCH 0
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Check if we need to mark functions as extern "C"
|
||||
////////////////////////////////////////////////////////////
|
||||
#ifdef __cplusplus
|
||||
#define CSFML_EXTERN_C extern "C"
|
||||
#else
|
||||
#define CSFML_EXTERN_C extern
|
||||
#endif
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Identify the operating system
|
||||
////////////////////////////////////////////////////////////
|
||||
#if defined(_WIN32) || defined(__WIN32__)
|
||||
|
||||
// Windows
|
||||
#define CSFML_SYSTEM_WINDOWS
|
||||
|
||||
#elif defined(linux) || defined(__linux)
|
||||
|
||||
// Linux
|
||||
#define CSFML_SYSTEM_LINUX
|
||||
|
||||
#elif defined(__APPLE__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh)
|
||||
|
||||
// MacOS
|
||||
#define CSFML_SYSTEM_MACOS
|
||||
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
|
||||
// FreeBSD
|
||||
#define CSFML_SYSTEM_FREEBSD
|
||||
|
||||
#else
|
||||
|
||||
// Unsupported system
|
||||
#error This operating system is not supported by SFML library
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Define helpers to create portable import / export macros for each module
|
||||
////////////////////////////////////////////////////////////
|
||||
#if !defined(CSFML_STATIC)
|
||||
|
||||
#if defined(CSFML_SYSTEM_WINDOWS)
|
||||
|
||||
// Windows compilers need specific (and different) keywords for export and import
|
||||
#define CSFML_API_EXPORT extern "C" __declspec(dllexport)
|
||||
#define CSFML_API_IMPORT CSFML_EXTERN_C __declspec(dllimport)
|
||||
|
||||
// For Visual C++ compilers, we also need to turn off this annoying C4251 warning
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#pragma warning(disable : 4251)
|
||||
|
||||
#endif
|
||||
|
||||
#else // Linux, FreeBSD, Mac OS X
|
||||
|
||||
#define CSFML_API_EXPORT extern "C" __attribute__((__visibility__("default")))
|
||||
#define CSFML_API_IMPORT CSFML_EXTERN_C __attribute__((__visibility__("default")))
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
// Static build doesn't need import/export macros
|
||||
#define CSFML_API_EXPORT extern "C"
|
||||
#define CSFML_API_IMPORT CSFML_EXTERN_C
|
||||
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Cross-platform warning for deprecated functions and classes
|
||||
//
|
||||
// Usage:
|
||||
// struct CSFML_DEPRECATED MyStruct
|
||||
// {
|
||||
// ...
|
||||
// };
|
||||
//
|
||||
// CSFML_DEPRECATED void globalFunc(void);
|
||||
////////////////////////////////////////////////////////////
|
||||
#if defined(CSFML_NO_DEPRECATED_WARNINGS)
|
||||
|
||||
// User explicitly requests to disable deprecation warnings
|
||||
#define CSFML_DEPRECATED
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
// Microsoft C++ compiler
|
||||
// Note: On newer MSVC versions, using deprecated functions causes a compiler error. In order to
|
||||
// trigger a warning instead of an error, the compiler flag /sdl- (instead of /sdl) must be specified.
|
||||
#define CSFML_DEPRECATED __declspec(deprecated)
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
// g++ and Clang
|
||||
#define CSFML_DEPRECATED __attribute__((deprecated))
|
||||
|
||||
#else
|
||||
|
||||
// Other compilers are not supported, leave class or function as-is.
|
||||
// With a bit of luck, the #pragma directive works, otherwise users get a warning (no error!) for unrecognized #pragma.
|
||||
#pragma message("CSFML_DEPRECATED is not supported for your compiler, please contact the CSFML team")
|
||||
#define CSFML_DEPRECATED
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Define sfChar32
|
||||
///
|
||||
/// Work around macOS not providing <uchar.h>
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <stdint.h>
|
||||
typedef uint32_t sfChar32;
|
||||
@@ -0,0 +1,69 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <CSFML/Config.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \file
|
||||
///
|
||||
/// \brief File containing SFML_DEFINE_DISCRETE_GPU_PREFERENCE
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \def SFML_DEFINE_DISCRETE_GPU_PREFERENCE
|
||||
///
|
||||
/// \brief A macro to encourage usage of the discrete GPU
|
||||
///
|
||||
/// In order to inform the Nvidia/AMD driver that an SFML
|
||||
/// application could benefit from using the more powerful
|
||||
/// discrete GPU, special symbols have to be publicly
|
||||
/// exported from the final executable.
|
||||
///
|
||||
/// SFML defines a helper macro to easily do this.
|
||||
///
|
||||
/// Place SFML_DEFINE_DISCRETE_GPU_PREFERENCE in the
|
||||
/// global scope of a source file that will be linked into
|
||||
/// the final executable. Typically it is best to place it
|
||||
/// where the main function is also defined.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
#if defined(SFML_SYSTEM_WINDOWS)
|
||||
|
||||
#define SFML_DEFINE_DISCRETE_GPU_PREFERENCE \
|
||||
CSFML_EXTERN_C __declspec(dllexport) unsigned long NvOptimusEnablement = 1; \
|
||||
CSFML_EXTERN_C __declspec(dllexport) unsigned long AmdPowerXpressRequestHighPerformance = 1;
|
||||
|
||||
#else
|
||||
|
||||
#define SFML_DEFINE_DISCRETE_GPU_PREFERENCE
|
||||
|
||||
#endif
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,36 +22,35 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_GRAPHICS_H
|
||||
#define SFML_GRAPHICS_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#include <SFML/Window.h>
|
||||
#include <SFML/Graphics/BlendMode.h>
|
||||
#include <SFML/Graphics/CircleShape.h>
|
||||
#include <SFML/Graphics/Color.h>
|
||||
#include <SFML/Graphics/ConvexShape.h>
|
||||
#include <SFML/Graphics/Font.h>
|
||||
#include <SFML/Graphics/Glyph.h>
|
||||
#include <SFML/Graphics/Image.h>
|
||||
#include <SFML/Graphics/PrimitiveType.h>
|
||||
#include <SFML/Graphics/Rect.h>
|
||||
#include <SFML/Graphics/RectangleShape.h>
|
||||
#include <SFML/Graphics/RenderStates.h>
|
||||
#include <SFML/Graphics/RenderWindow.h>
|
||||
#include <SFML/Graphics/RenderTexture.h>
|
||||
#include <SFML/Graphics/Shader.h>
|
||||
#include <SFML/Graphics/Shape.h>
|
||||
#include <SFML/Graphics/Text.h>
|
||||
#include <SFML/Graphics/Texture.h>
|
||||
#include <SFML/Graphics/Transform.h>
|
||||
#include <SFML/Graphics/Transformable.h>
|
||||
#include <SFML/Graphics/Vertex.h>
|
||||
#include <SFML/Graphics/VertexArray.h>
|
||||
#include <SFML/Graphics/View.h>
|
||||
|
||||
|
||||
#endif // SFML_GRAPHICS_H
|
||||
#include <CSFML/Graphics/BlendMode.h>
|
||||
#include <CSFML/Graphics/CircleShape.h>
|
||||
#include <CSFML/Graphics/Color.h>
|
||||
#include <CSFML/Graphics/ConvexShape.h>
|
||||
#include <CSFML/Graphics/Font.h>
|
||||
#include <CSFML/Graphics/FontInfo.h>
|
||||
#include <CSFML/Graphics/Glyph.h>
|
||||
#include <CSFML/Graphics/Image.h>
|
||||
#include <CSFML/Graphics/PrimitiveType.h>
|
||||
#include <CSFML/Graphics/Rect.h>
|
||||
#include <CSFML/Graphics/RectangleShape.h>
|
||||
#include <CSFML/Graphics/RenderStates.h>
|
||||
#include <CSFML/Graphics/RenderTexture.h>
|
||||
#include <CSFML/Graphics/RenderWindow.h>
|
||||
#include <CSFML/Graphics/Shader.h>
|
||||
#include <CSFML/Graphics/Shape.h>
|
||||
#include <CSFML/Graphics/Sprite.h>
|
||||
#include <CSFML/Graphics/Text.h>
|
||||
#include <CSFML/Graphics/Texture.h>
|
||||
#include <CSFML/Graphics/Transform.h>
|
||||
#include <CSFML/Graphics/Transformable.h>
|
||||
#include <CSFML/Graphics/Vertex.h>
|
||||
#include <CSFML/Graphics/VertexArray.h>
|
||||
#include <CSFML/Graphics/VertexBuffer.h>
|
||||
#include <CSFML/Graphics/View.h>
|
||||
#include <CSFML/Window.h>
|
||||
@@ -0,0 +1,86 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <CSFML/Graphics/Export.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Enumeration of the blending factors
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef enum
|
||||
{
|
||||
sfBlendFactorZero, ///< (0, 0, 0, 0)
|
||||
sfBlendFactorOne, ///< (1, 1, 1, 1)
|
||||
sfBlendFactorSrcColor, ///< (src.r, src.g, src.b, src.a)
|
||||
sfBlendFactorOneMinusSrcColor, ///< (1, 1, 1, 1) - (src.r, src.g, src.b, src.a)
|
||||
sfBlendFactorDstColor, ///< (dst.r, dst.g, dst.b, dst.a)
|
||||
sfBlendFactorOneMinusDstColor, ///< (1, 1, 1, 1) - (dst.r, dst.g, dst.b, dst.a)
|
||||
sfBlendFactorSrcAlpha, ///< (src.a, src.a, src.a, src.a)
|
||||
sfBlendFactorOneMinusSrcAlpha, ///< (1, 1, 1, 1) - (src.a, src.a, src.a, src.a)
|
||||
sfBlendFactorDstAlpha, ///< (dst.a, dst.a, dst.a, dst.a)
|
||||
sfBlendFactorOneMinusDstAlpha ///< (1, 1, 1, 1) - (dst.a, dst.a, dst.a, dst.a)
|
||||
} sfBlendFactor;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Enumeration of the blending equations
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef enum
|
||||
{
|
||||
sfBlendEquationAdd, ///< Pixel = Src * SrcFactor + Dst * DstFactor
|
||||
sfBlendEquationSubtract, ///< Pixel = Src * SrcFactor - Dst * DstFactor
|
||||
sfBlendEquationReverseSubtract, ///< Pixel = Dst * DstFactor - Src * SrcFactor
|
||||
sfBlendEquationMin, ///< Pixel = min(Dst, Src)
|
||||
sfBlendEquationMax ///< Pixel = max(Dst, Src)
|
||||
} sfBlendEquation;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Blending mode for drawing
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
sfBlendFactor colorSrcFactor; ///< Source blending factor for the color channels
|
||||
sfBlendFactor colorDstFactor; ///< Destination blending factor for the color channels
|
||||
sfBlendEquation colorEquation; ///< Blending equation for the color channels
|
||||
sfBlendFactor alphaSrcFactor; ///< Source blending factor for the alpha channel
|
||||
sfBlendFactor alphaDstFactor; ///< Destination blending factor for the alpha channel
|
||||
sfBlendEquation alphaEquation; ///< Blending equation for the alpha channel
|
||||
} sfBlendMode;
|
||||
|
||||
|
||||
CSFML_GRAPHICS_API const sfBlendMode sfBlendAlpha; ///< Blend source and dest according to dest alpha
|
||||
CSFML_GRAPHICS_API const sfBlendMode sfBlendAdd; ///< Add source to dest
|
||||
CSFML_GRAPHICS_API const sfBlendMode sfBlendMultiply; ///< Multiply source and dest
|
||||
CSFML_GRAPHICS_API const sfBlendMode sfBlendMin; ///< Take minimum between source and dest
|
||||
CSFML_GRAPHICS_API const sfBlendMode sfBlendMax; ///< Take maximum between source and dest
|
||||
CSFML_GRAPHICS_API const sfBlendMode sfBlendNone; ///< Overwrite dest with source
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,17 +22,20 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_CIRCLESHAPE_H
|
||||
#define SFML_CIRCLESHAPE_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Graphics/Export.h>
|
||||
#include <SFML/Graphics/Color.h>
|
||||
#include <SFML/Graphics/Rect.h>
|
||||
#include <SFML/Graphics/Types.h>
|
||||
#include <SFML/System/Vector2.h>
|
||||
#include <CSFML/Graphics/Export.h>
|
||||
|
||||
#include <CSFML/Graphics/Color.h>
|
||||
#include <CSFML/Graphics/Rect.h>
|
||||
#include <CSFML/Graphics/Transform.h>
|
||||
#include <CSFML/Graphics/Types.h>
|
||||
#include <CSFML/System/Vector2.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -51,15 +54,15 @@ CSFML_GRAPHICS_API sfCircleShape* sfCircleShape_create(void);
|
||||
/// \return Copied object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfCircleShape* sfCircleShape_copy(sfCircleShape* shape);
|
||||
CSFML_GRAPHICS_API sfCircleShape* sfCircleShape_copy(const sfCircleShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destroy an existing circle Shape
|
||||
///
|
||||
/// \param Shape Shape to delete
|
||||
/// \param shape Shape to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfCircleShape_destroy(sfCircleShape* shape);
|
||||
CSFML_GRAPHICS_API void sfCircleShape_destroy(const sfCircleShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the position of a circle shape
|
||||
@@ -146,7 +149,7 @@ CSFML_GRAPHICS_API float sfCircleShape_getRotation(const sfCircleShape* shape);
|
||||
/// \return Current scale factors
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2f sfCircleShape_GetScale(const sfCircleShape* shape);
|
||||
CSFML_GRAPHICS_API sfVector2f sfCircleShape_getScale(const sfCircleShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the local origin of a circle shape
|
||||
@@ -156,7 +159,7 @@ CSFML_GRAPHICS_API sfVector2f sfCircleShape_GetScale(const sfCircleShape* shape)
|
||||
/// \return Current origin
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2f sfCircleShape_GetOrigin(const sfCircleShape* shape);
|
||||
CSFML_GRAPHICS_API sfVector2f sfCircleShape_getOrigin(const sfCircleShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Move a circle shape by a given offset
|
||||
@@ -202,7 +205,7 @@ CSFML_GRAPHICS_API void sfCircleShape_scale(sfCircleShape* shape, sfVector2f fac
|
||||
/// \return Transform combining the position/rotation/scale/origin of the object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API const sfTransform* sfCircleShape_getTransform(const sfCircleShape* shape);
|
||||
CSFML_GRAPHICS_API sfTransform sfCircleShape_getTransform(const sfCircleShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the inverse of the combined transform of a circle shape
|
||||
@@ -212,7 +215,7 @@ CSFML_GRAPHICS_API const sfTransform* sfCircleShape_getTransform(const sfCircleS
|
||||
/// \return Inverse of the combined transformations applied to the object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API const sfTransform* sfCircleShape_getInverseTransform(const sfCircleShape* shape);
|
||||
CSFML_GRAPHICS_API sfTransform sfCircleShape_getInverseTransform(const sfCircleShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change the source texture of a circle shape
|
||||
@@ -233,7 +236,7 @@ CSFML_GRAPHICS_API const sfTransform* sfCircleShape_getInverseTransform(const sf
|
||||
/// \param resetRect Should the texture rect be reset to the size of the new texture?
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfCircleShape_setTexture(sfCircleShape* shape, const sfTexture* texture, sfBool resetRect);
|
||||
CSFML_GRAPHICS_API void sfCircleShape_setTexture(sfCircleShape* shape, const sfTexture* texture, bool resetRect);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the sub-rectangle of the texture that a circle shape will display
|
||||
@@ -351,7 +354,7 @@ CSFML_GRAPHICS_API float sfCircleShape_getOutlineThickness(const sfCircleShape*
|
||||
/// \return Number of points of the shape
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API unsigned int sfCircleShape_getPointCount(const sfCircleShape* shape);
|
||||
CSFML_GRAPHICS_API size_t sfCircleShape_getPointCount(const sfCircleShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get a point of a circle shape
|
||||
@@ -364,7 +367,21 @@ CSFML_GRAPHICS_API unsigned int sfCircleShape_getPointCount(const sfCircleShape*
|
||||
/// \return Index-th point of the shape
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2f sfCircleShape_getPoint(const sfCircleShape* shape, unsigned int index);
|
||||
CSFML_GRAPHICS_API sfVector2f sfCircleShape_getPoint(const sfCircleShape* shape, size_t index);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the geometric center of the circle
|
||||
///
|
||||
/// The returned point is in local coordinates, that is,
|
||||
/// the shape's transforms (position, rotation, scale) are
|
||||
/// not taken into account.
|
||||
///
|
||||
/// \param shape Shape object
|
||||
///
|
||||
/// \return The geometric center of the shape
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2f sfCircleShape_getGeometricCenter(const sfCircleShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the radius of a circle
|
||||
@@ -392,7 +409,7 @@ CSFML_GRAPHICS_API float sfCircleShape_getRadius(const sfCircleShape* shape);
|
||||
/// \param count New number of points of the circle
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfCircleShape_setPointCount(sfCircleShape* shape, unsigned int count);
|
||||
CSFML_GRAPHICS_API void sfCircleShape_setPointCount(sfCircleShape* shape, size_t count);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the local bounding rectangle of a circle shape
|
||||
@@ -425,6 +442,3 @@ CSFML_GRAPHICS_API sfFloatRect sfCircleShape_getLocalBounds(const sfCircleShape*
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfFloatRect sfCircleShape_getGlobalBounds(const sfCircleShape* shape);
|
||||
|
||||
|
||||
#endif // SFML_CIRCLESHAPE_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,13 +22,12 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_COLOR_H
|
||||
#define SFML_COLOR_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Graphics/Export.h>
|
||||
#include <CSFML/Graphics/Export.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -37,22 +36,22 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
sfUint8 r;
|
||||
sfUint8 g;
|
||||
sfUint8 b;
|
||||
sfUint8 a;
|
||||
uint8_t r;
|
||||
uint8_t g;
|
||||
uint8_t b;
|
||||
uint8_t a;
|
||||
} sfColor;
|
||||
|
||||
|
||||
CSFML_GRAPHICS_API sfColor sfBlack; ///< Black predefined color
|
||||
CSFML_GRAPHICS_API sfColor sfWhite; ///< White predefined color
|
||||
CSFML_GRAPHICS_API sfColor sfRed; ///< Red predefined color
|
||||
CSFML_GRAPHICS_API sfColor sfGreen; ///< Green predefined color
|
||||
CSFML_GRAPHICS_API sfColor sfBlue; ///< Blue predefined color
|
||||
CSFML_GRAPHICS_API sfColor sfYellow; ///< Yellow predefined color
|
||||
CSFML_GRAPHICS_API sfColor sfMagenta; ///< Magenta predefined color
|
||||
CSFML_GRAPHICS_API sfColor sfCyan; ///< Cyan predefined color
|
||||
CSFML_GRAPHICS_API sfColor sfTransparent; ///< Transparent (black) predefined color
|
||||
CSFML_GRAPHICS_API const sfColor sfBlack; ///< Black predefined color
|
||||
CSFML_GRAPHICS_API const sfColor sfWhite; ///< White predefined color
|
||||
CSFML_GRAPHICS_API const sfColor sfRed; ///< Red predefined color
|
||||
CSFML_GRAPHICS_API const sfColor sfGreen; ///< Green predefined color
|
||||
CSFML_GRAPHICS_API const sfColor sfBlue; ///< Blue predefined color
|
||||
CSFML_GRAPHICS_API const sfColor sfYellow; ///< Yellow predefined color
|
||||
CSFML_GRAPHICS_API const sfColor sfMagenta; ///< Magenta predefined color
|
||||
CSFML_GRAPHICS_API const sfColor sfCyan; ///< Cyan predefined color
|
||||
CSFML_GRAPHICS_API const sfColor sfTransparent; ///< Transparent (black) predefined color
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -65,7 +64,7 @@ CSFML_GRAPHICS_API sfColor sfTransparent; ///< Transparent (black) predefined co
|
||||
/// \return sfColor constructed from the components
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfColor sfColor_fromRGB(sfUint8 red, sfUint8 green, sfUint8 blue);
|
||||
CSFML_GRAPHICS_API sfColor sfColor_fromRGB(uint8_t red, uint8_t green, uint8_t blue);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Construct a color from its 4 RGBA components
|
||||
@@ -78,7 +77,25 @@ CSFML_GRAPHICS_API sfColor sfColor_fromRGB(sfUint8 red, sfUint8 green, sfUint8 b
|
||||
/// \return sfColor constructed from the components
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfColor sfColor_fromRGBA(sfUint8 red, sfUint8 green, sfUint8 blue, sfUint8 alpha);
|
||||
CSFML_GRAPHICS_API sfColor sfColor_fromRGBA(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Construct the color from 32-bit unsigned integer
|
||||
///
|
||||
/// \param color Number containing the RGBA components (in that order)
|
||||
///
|
||||
/// \return sfColor constructed from the 32-bit unsigned integer
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfColor sfColor_fromInteger(uint32_t color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Convert a color to a 32-bit unsigned integer
|
||||
///
|
||||
/// \return Color represented as a 32-bit unsigned integer
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API uint32_t sfColor_toInteger(sfColor color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Add two colors
|
||||
@@ -91,6 +108,17 @@ CSFML_GRAPHICS_API sfColor sfColor_fromRGBA(sfUint8 red, sfUint8 green, sfUint8
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfColor sfColor_add(sfColor color1, sfColor color2);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Subtract two colors
|
||||
///
|
||||
/// \param color1 First color
|
||||
/// \param color2 Second color
|
||||
///
|
||||
/// \return Component-wise saturated subtraction of the two colors
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfColor sfColor_subtract(sfColor color1, sfColor color2);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Modulate two colors
|
||||
///
|
||||
@@ -101,6 +129,3 @@ CSFML_GRAPHICS_API sfColor sfColor_add(sfColor color1, sfColor color2);
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfColor sfColor_modulate(sfColor color1, sfColor color2);
|
||||
|
||||
|
||||
#endif // SFML_COLOR_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,17 +22,20 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_CONVEXSHAPE_H
|
||||
#define SFML_CONVEXSHAPE_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Graphics/Export.h>
|
||||
#include <SFML/Graphics/Color.h>
|
||||
#include <SFML/Graphics/Rect.h>
|
||||
#include <SFML/Graphics/Types.h>
|
||||
#include <SFML/System/Vector2.h>
|
||||
#include <CSFML/Graphics/Export.h>
|
||||
|
||||
#include <CSFML/Graphics/Color.h>
|
||||
#include <CSFML/Graphics/Rect.h>
|
||||
#include <CSFML/Graphics/Transform.h>
|
||||
#include <CSFML/Graphics/Types.h>
|
||||
#include <CSFML/System/Vector2.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -51,15 +54,15 @@ CSFML_GRAPHICS_API sfConvexShape* sfConvexShape_create(void);
|
||||
/// \return Copied object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfConvexShape* sfConvexShape_copy(sfConvexShape* shape);
|
||||
CSFML_GRAPHICS_API sfConvexShape* sfConvexShape_copy(const sfConvexShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destroy an existing convex Shape
|
||||
///
|
||||
/// \param Shape Shape to delete
|
||||
/// \param shape Shape to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfConvexShape_destroy(sfConvexShape* shape);
|
||||
CSFML_GRAPHICS_API void sfConvexShape_destroy(const sfConvexShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the position of a convex shape
|
||||
@@ -202,7 +205,7 @@ CSFML_GRAPHICS_API void sfConvexShape_scale(sfConvexShape* shape, sfVector2f fac
|
||||
/// \return Transform combining the position/rotation/scale/origin of the object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API const sfTransform* sfConvexShape_getTransform(const sfConvexShape* shape);
|
||||
CSFML_GRAPHICS_API sfTransform sfConvexShape_getTransform(const sfConvexShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the inverse of the combined transform of a convex shape
|
||||
@@ -212,7 +215,7 @@ CSFML_GRAPHICS_API const sfTransform* sfConvexShape_getTransform(const sfConvexS
|
||||
/// \return Inverse of the combined transformations applied to the object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API const sfTransform* sfConvexShape_getInverseTransform(const sfConvexShape* shape);
|
||||
CSFML_GRAPHICS_API sfTransform sfConvexShape_getInverseTransform(const sfConvexShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change the source texture of a convex shape
|
||||
@@ -233,7 +236,7 @@ CSFML_GRAPHICS_API const sfTransform* sfConvexShape_getInverseTransform(const sf
|
||||
/// \param resetRect Should the texture rect be reset to the size of the new texture?
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfConvexShape_setTexture(sfConvexShape* shape, const sfTexture* texture, sfBool resetRect);
|
||||
CSFML_GRAPHICS_API void sfConvexShape_setTexture(sfConvexShape* shape, const sfTexture* texture, bool resetRect);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the sub-rectangle of the texture that a convex shape will display
|
||||
@@ -351,7 +354,7 @@ CSFML_GRAPHICS_API float sfConvexShape_getOutlineThickness(const sfConvexShape*
|
||||
/// \return Number of points of the shape
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API unsigned int sfConvexShape_getPointCount(const sfConvexShape* shape);
|
||||
CSFML_GRAPHICS_API size_t sfConvexShape_getPointCount(const sfConvexShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get a point of a convex shape
|
||||
@@ -364,7 +367,21 @@ CSFML_GRAPHICS_API unsigned int sfConvexShape_getPointCount(const sfConvexShape*
|
||||
/// \return Index-th point of the shape
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2f sfConvexShape_getPoint(const sfConvexShape* shape, unsigned int index);
|
||||
CSFML_GRAPHICS_API sfVector2f sfConvexShape_getPoint(const sfConvexShape* shape, size_t index);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the geometric center of a convex shape
|
||||
///
|
||||
/// The returned point is in local coordinates, that is,
|
||||
/// the shape's transforms (position, rotation, scale) are
|
||||
/// not taken into account.
|
||||
///
|
||||
/// \param shape Shape object
|
||||
///
|
||||
/// \return The geometric center of the shape
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2f sfConvexShape_getGeometricCenter(const sfConvexShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the number of points of a convex shap
|
||||
@@ -375,7 +392,7 @@ CSFML_GRAPHICS_API sfVector2f sfConvexShape_getPoint(const sfConvexShape* shape,
|
||||
/// \param count New number of points of the shape
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfConvexShape_setPointCount(sfConvexShape* shape, unsigned int count);
|
||||
CSFML_GRAPHICS_API void sfConvexShape_setPointCount(sfConvexShape* shape, size_t count);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the position of a point in a convex shape
|
||||
@@ -387,11 +404,11 @@ CSFML_GRAPHICS_API void sfConvexShape_setPointCount(sfConvexShape* shape, unsign
|
||||
/// of the valid range.
|
||||
///
|
||||
/// \param shape Shape object
|
||||
/// \param index Index of the point to change, in range [0 .. GetPointCount() - 1]
|
||||
/// \param index Index of the point to change, in range [0 .. getPointCount() - 1]
|
||||
/// \param point New point
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfConvexShape_setPoint(sfConvexShape* shape, unsigned int index, sfVector2f point);
|
||||
CSFML_GRAPHICS_API void sfConvexShape_setPoint(sfConvexShape* shape, size_t index, sfVector2f point);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the local bounding rectangle of a convex shape
|
||||
@@ -424,6 +441,3 @@ CSFML_GRAPHICS_API sfFloatRect sfConvexShape_getLocalBounds(const sfConvexShape*
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfFloatRect sfConvexShape_getGlobalBounds(const sfConvexShape* shape);
|
||||
|
||||
|
||||
#endif // SFML_CONVEXSHAPE_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,20 +22,14 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_AUDIO_H
|
||||
#define SFML_AUDIO_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
/// \brief Types of texture coordinates that can be used for rendering.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#include <SFML/System.h>
|
||||
#include <SFML/Audio/Listener.h>
|
||||
#include <SFML/Audio/Music.h>
|
||||
#include <SFML/Audio/Sound.h>
|
||||
#include <SFML/Audio/SoundBuffer.h>
|
||||
#include <SFML/Audio/SoundBufferRecorder.h>
|
||||
#include <SFML/Audio/SoundRecorder.h>
|
||||
|
||||
|
||||
#endif // SFML_AUDIO_H
|
||||
typedef enum
|
||||
{
|
||||
sfCoordinateTypeNormalized, ///< sfTexture coordinates in range [0 .. 1].
|
||||
sfCoordinateTypePixels ///< sfTexture coordinates in range [0 .. size].
|
||||
} sfCoordinateType;
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,13 +22,12 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_GRAPHICS_EXPORT_H
|
||||
#define SFML_GRAPHICS_EXPORT_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <CSFML/Config.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -36,13 +35,10 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
#if defined(CSFML_GRAPHICS_EXPORTS)
|
||||
|
||||
#define CSFML_GRAPHICS_API CSFML_API_EXPORT
|
||||
#define CSFML_GRAPHICS_API CSFML_API_EXPORT
|
||||
|
||||
#else
|
||||
|
||||
#define CSFML_GRAPHICS_API CSFML_API_IMPORT
|
||||
#define CSFML_GRAPHICS_API CSFML_API_IMPORT
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif // SFML_GRAPHICS_EXPORT_H
|
||||
@@ -0,0 +1,239 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <CSFML/Graphics/Export.h>
|
||||
|
||||
#include <CSFML/Graphics/FontInfo.h>
|
||||
#include <CSFML/Graphics/Glyph.h>
|
||||
#include <CSFML/Graphics/Types.h>
|
||||
#include <CSFML/System/InputStream.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new font from a file
|
||||
///
|
||||
/// \param filename Path of the font file to load
|
||||
///
|
||||
/// \return A new sfFont object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfFont* sfFont_createFromFile(const char* filename);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new image font a file in memory
|
||||
///
|
||||
/// \param data Pointer to the file data in memory
|
||||
/// \param sizeInBytes Size of the data to load, in bytes
|
||||
///
|
||||
/// \return A new sfFont object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfFont* sfFont_createFromMemory(const void* data, size_t sizeInBytes);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new image font a custom stream
|
||||
///
|
||||
/// \param stream Source stream to read from
|
||||
///
|
||||
/// \return A new sfFont object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfFont* sfFont_createFromStream(sfInputStream* stream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Copy an existing font
|
||||
///
|
||||
/// \param font Font to copy
|
||||
///
|
||||
/// \return Copied object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfFont* sfFont_copy(const sfFont* font);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destroy an existing font
|
||||
///
|
||||
/// \param font Font to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfFont_destroy(const sfFont* font);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get a glyph in a font
|
||||
///
|
||||
/// \param font Source font
|
||||
/// \param codePoint Unicode code point of the character to get
|
||||
/// \param characterSize Character size, in pixels
|
||||
/// \param bold Retrieve the bold version or the regular one?
|
||||
/// \param outlineThickness Thickness of outline (when != 0 the glyph will not be filled)
|
||||
///
|
||||
/// \return The corresponding glyph
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfGlyph
|
||||
sfFont_getGlyph(const sfFont* font, uint32_t codePoint, unsigned int characterSize, bool bold, float outlineThickness);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Determine if this font has a glyph representing the requested code point
|
||||
///
|
||||
/// Most fonts only include a very limited selection of glyphs from
|
||||
/// specific Unicode subsets, like Latin, Cyrillic, or Asian characters.
|
||||
///
|
||||
/// While code points without representation will return a font specific
|
||||
/// default character, it might be useful to verify whether specific
|
||||
/// code points are included to determine whether a font is suited
|
||||
/// to display text in a specific language.
|
||||
///
|
||||
/// \param font Source font
|
||||
/// \param codePoint Unicode code point to check
|
||||
///
|
||||
/// \return True if the codepoint has a glyph representation, sfFalse otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API bool sfFont_hasGlyph(const sfFont* font, uint32_t codePoint);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the kerning value corresponding to a given pair of characters in a font
|
||||
///
|
||||
/// \param font Source font
|
||||
/// \param first Unicode code point of the first character
|
||||
/// \param second Unicode code point of the second character
|
||||
/// \param characterSize Character size, in pixels
|
||||
///
|
||||
/// \return Kerning offset, in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API float sfFont_getKerning(const sfFont* font, uint32_t first, uint32_t second, unsigned int characterSize);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the bold kerning value corresponding to a given pair of characters in a font
|
||||
///
|
||||
/// \param font Source font
|
||||
/// \param first Unicode code point of the first character
|
||||
/// \param second Unicode code point of the second character
|
||||
/// \param characterSize Character size, in pixels
|
||||
///
|
||||
/// \return Kerning offset, in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API float sfFont_getBoldKerning(const sfFont* font, uint32_t first, uint32_t second, unsigned int characterSize);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the line spacing value
|
||||
///
|
||||
/// \param font Source font
|
||||
/// \param characterSize Character size, in pixels
|
||||
///
|
||||
/// \return Line spacing, in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API float sfFont_getLineSpacing(const sfFont* font, unsigned int characterSize);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the position of the underline
|
||||
///
|
||||
/// Underline position is the vertical offset to apply between the
|
||||
/// baseline and the underline.
|
||||
///
|
||||
/// \param font Source font
|
||||
/// \param characterSize Reference character size
|
||||
///
|
||||
/// \return Underline position, in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API float sfFont_getUnderlinePosition(const sfFont* font, unsigned int characterSize);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the thickness of the underline
|
||||
///
|
||||
/// Underline thickness is the vertical size of the underline.
|
||||
///
|
||||
/// \param font Source font
|
||||
/// \param characterSize Reference character size
|
||||
///
|
||||
/// \return Underline thickness, in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API float sfFont_getUnderlineThickness(const sfFont* font, unsigned int characterSize);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the texture containing the glyphs of a given size in a font
|
||||
///
|
||||
/// \param font Source font
|
||||
/// \param characterSize Character size, in pixels
|
||||
///
|
||||
/// \return Read-only pointer to the texture
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API const sfTexture* sfFont_getTexture(sfFont* font, unsigned int characterSize);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Enable or disable the smooth filter
|
||||
///
|
||||
/// When the filter is activated, the font appears smoother
|
||||
/// so that pixels are less noticeable. However if you want
|
||||
/// the font to look exactly the same as its source file,
|
||||
/// you should disable it.
|
||||
/// The smooth filter is enabled by default.
|
||||
///
|
||||
/// \param font Source font
|
||||
/// \param smooth true to enable smoothing, false to disable it
|
||||
///
|
||||
/// \see isSmooth
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfFont_setSmooth(sfFont* font, bool smooth);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether the smooth filter is enabled or disabled
|
||||
///
|
||||
/// \param font Source font
|
||||
///
|
||||
/// \return true if smoothing is enabled, false if it is disabled
|
||||
///
|
||||
/// \see setSmooth
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API bool sfFont_isSmooth(const sfFont* font);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the font information
|
||||
///
|
||||
/// The returned structure will remain valid only if the font
|
||||
/// is still valid. If the font is invalid an invalid structure
|
||||
/// is returned.
|
||||
///
|
||||
/// \param font Source font
|
||||
///
|
||||
/// \return A structure that holds the font information
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfFontInfo sfFont_getInfo(const sfFont* font);
|
||||
@@ -0,0 +1,38 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <CSFML/Graphics/Export.h>
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// sfFontInfo holds various information about a font
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
const char* family;
|
||||
} sfFontInfo;
|
||||
@@ -0,0 +1,96 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <CSFML/Graphics/Color.h>
|
||||
#include <CSFML/Graphics/Transform.h>
|
||||
#include <CSFML/System/Vector2.h>
|
||||
#include <CSFML/System/Vector3.h>
|
||||
|
||||
// 2D vectors
|
||||
typedef sfVector2f sfGlslVec2;
|
||||
typedef sfVector2i sfGlslIvec2;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool x;
|
||||
bool y;
|
||||
} sfGlslBvec2;
|
||||
|
||||
// 3D vectors
|
||||
typedef sfVector3f sfGlslVec3;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
} sfGlslIvec3;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool x;
|
||||
bool y;
|
||||
bool z;
|
||||
} sfGlslBvec3;
|
||||
|
||||
// 4D vectors
|
||||
typedef struct
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float w;
|
||||
} sfGlslVec4;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
int w;
|
||||
} sfGlslIvec4;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool x;
|
||||
bool y;
|
||||
bool z;
|
||||
bool w;
|
||||
} sfGlslBvec4;
|
||||
|
||||
// matrices
|
||||
typedef struct
|
||||
{
|
||||
float array[3 * 3];
|
||||
} sfGlslMat3;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float array[4 * 4];
|
||||
} sfGlslMat4;
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,13 +22,12 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_GLYPH_H
|
||||
#define SFML_GLYPH_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Graphics/Rect.h>
|
||||
#include <CSFML/Graphics/Rect.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -37,10 +36,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
int advance; ///< Offset to move horizontically to the next character
|
||||
sfIntRect bounds; ///< Bounding rectangle of the glyph, in coordinates relative to the baseline
|
||||
sfIntRect textureRect; ///< Texture coordinates of the glyph inside the font's image
|
||||
float advance; ///< Offset to move horizontically to the next character
|
||||
sfFloatRect bounds; ///< Bounding rectangle of the glyph, in coordinates relative to the baseline
|
||||
sfIntRect textureRect; ///< Texture coordinates of the glyph inside the font's image
|
||||
} sfGlyph;
|
||||
|
||||
|
||||
#endif // SFML_GLYPH_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,18 +22,20 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_IMAGE_H
|
||||
#define SFML_IMAGE_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Graphics/Export.h>
|
||||
#include <SFML/Graphics/Color.h>
|
||||
#include <SFML/Graphics/Rect.h>
|
||||
#include <SFML/Graphics/Types.h>
|
||||
#include <SFML/System/InputStream.h>
|
||||
#include <SFML/System/Vector2.h>
|
||||
#include <CSFML/Graphics/Export.h>
|
||||
|
||||
#include <CSFML/Graphics/Color.h>
|
||||
#include <CSFML/Graphics/Rect.h>
|
||||
#include <CSFML/Graphics/Types.h>
|
||||
#include <CSFML/System/Buffer.h>
|
||||
#include <CSFML/System/InputStream.h>
|
||||
#include <CSFML/System/Vector2.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
@@ -42,25 +44,23 @@
|
||||
///
|
||||
/// This image is filled with black pixels.
|
||||
///
|
||||
/// \param width Width of the image
|
||||
/// \param height Height of the image
|
||||
/// \param size Size of the image
|
||||
///
|
||||
/// \return A new sfImage object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfImage* sfImage_create(unsigned int width, unsigned int height);
|
||||
CSFML_GRAPHICS_API sfImage* sfImage_create(sfVector2u size);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create an image and fill it with a unique color
|
||||
///
|
||||
/// \param width Width of the image
|
||||
/// \param height Height of the image
|
||||
/// \param color Fill color
|
||||
/// \param size Size of the image
|
||||
/// \param color Fill color
|
||||
///
|
||||
/// \return A new sfImage object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfImage* sfImage_createFromColor(unsigned int width, unsigned int height, sfColor color);
|
||||
CSFML_GRAPHICS_API sfImage* sfImage_createFromColor(sfVector2u size, sfColor color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create an image from an array of pixels
|
||||
@@ -70,14 +70,13 @@ CSFML_GRAPHICS_API sfImage* sfImage_createFromColor(unsigned int width, unsigned
|
||||
/// an undefined behaviour.
|
||||
/// If \a pixels is null, an empty image is created.
|
||||
///
|
||||
/// \param width Width of the image
|
||||
/// \param height Height of the image
|
||||
/// \param size Size of the image
|
||||
/// \param pixels Array of pixels to copy to the image
|
||||
///
|
||||
/// \return A new sfImage object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfImage* sfImage_createFromPixels(unsigned int width, unsigned int height, const sfUint8* pixels);
|
||||
CSFML_GRAPHICS_API sfImage* sfImage_createFromPixels(sfVector2u size, const uint8_t* pixels);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create an image from a file on disk
|
||||
@@ -133,7 +132,7 @@ CSFML_GRAPHICS_API sfImage* sfImage_createFromStream(sfInputStream* stream);
|
||||
/// \return Copied object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfImage* sfImage_copy(sfImage* image);
|
||||
CSFML_GRAPHICS_API sfImage* sfImage_copy(const sfImage* image);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destroy an existing image
|
||||
@@ -141,7 +140,7 @@ CSFML_GRAPHICS_API sfImage* sfImage_copy(sfImage* image);
|
||||
/// \param image Image to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfImage_destroy(sfImage* image);
|
||||
CSFML_GRAPHICS_API void sfImage_destroy(const sfImage* image);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Save an image to a file on disk
|
||||
@@ -154,10 +153,31 @@ CSFML_GRAPHICS_API void sfImage_destroy(sfImage* image);
|
||||
/// \param image Image object
|
||||
/// \param filename Path of the file to save
|
||||
///
|
||||
/// \return sfTrue if saving was successful
|
||||
/// \return true if saving was successful
|
||||
///
|
||||
/// \see sfImage_saveToMemory
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfBool sfImage_saveToFile(const sfImage* image, const char* filename);
|
||||
CSFML_GRAPHICS_API bool sfImage_saveToFile(const sfImage* image, const char* filename);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Save the image to a buffer in memory
|
||||
///
|
||||
/// The format of the image must be specified.
|
||||
/// The supported image formats are bmp, png, tga and jpg.
|
||||
/// This function fails if the image is empty, or if
|
||||
/// the format was invalid.
|
||||
///
|
||||
/// \param image Image object
|
||||
/// \param output Buffer to fill with encoded data
|
||||
/// \param format Encoding format to use
|
||||
///
|
||||
/// \return true if saving was successful
|
||||
///
|
||||
/// \see sfImage_saveToFile
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API bool sfImage_saveToMemory(const sfImage* image, sfBuffer* output, const char* format);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return the size of an image
|
||||
@@ -181,7 +201,7 @@ CSFML_GRAPHICS_API sfVector2u sfImage_getSize(const sfImage* image);
|
||||
/// \param alpha Alpha value to assign to transparent pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfImage_createMaskFromColor(sfColor color, sfUint8 alpha);
|
||||
CSFML_GRAPHICS_API void sfImage_createMaskFromColor(sfImage* image, sfColor color, uint8_t alpha);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Copy pixels from an image onto another
|
||||
@@ -198,13 +218,14 @@ CSFML_GRAPHICS_API void sfImage_createMaskFromColor(sfColor color, sfUint8 alpha
|
||||
///
|
||||
/// \param image Image object
|
||||
/// \param source Source image to copy
|
||||
/// \param destX X coordinate of the destination position
|
||||
/// \param destY Y coordinate of the destination position
|
||||
/// \param dest Coordinates of the destination position
|
||||
/// \param sourceRect Sub-rectangle of the source image to copy
|
||||
/// \param applyAlpha Should the copy take in account the source transparency?
|
||||
///
|
||||
/// \return True if the operation was successful, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfImage_copyImage(sfImage* image, const sfImage* source, unsigned int destX, unsigned int destY, sfIntRect sourceRect, sfBool applyAlpha);
|
||||
CSFML_GRAPHICS_API bool sfImage_copyImage(sfImage* image, const sfImage* source, sfVector2u dest, sfIntRect sourceRect, bool applyAlpha);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change the color of a pixel in an image
|
||||
@@ -213,13 +234,12 @@ CSFML_GRAPHICS_API void sfImage_copyImage(sfImage* image, const sfImage* source,
|
||||
/// coordinates, using out-of-range values will result in
|
||||
/// an undefined behaviour.
|
||||
///
|
||||
/// \param image Image object
|
||||
/// \param x X coordinate of pixel to change
|
||||
/// \param y Y coordinate of pixel to change
|
||||
/// \param color New color of the pixel
|
||||
/// \param image Image object
|
||||
/// \param coords Coordinates of pixel to change
|
||||
/// \param color New color of the pixel
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfImage_setPixel(sfImage* image, unsigned int x, unsigned int y, sfColor color);
|
||||
CSFML_GRAPHICS_API void sfImage_setPixel(sfImage* image, sfVector2u coords, sfColor color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the color of a pixel in an image
|
||||
@@ -228,14 +248,13 @@ CSFML_GRAPHICS_API void sfImage_setPixel(sfImage* image, unsigned int x, unsigne
|
||||
/// coordinates, using out-of-range values will result in
|
||||
/// an undefined behaviour.
|
||||
///
|
||||
/// \param image Image object
|
||||
/// \param x X coordinate of pixel to get
|
||||
/// \param y Y coordinate of pixel to get
|
||||
/// \param image Image object
|
||||
/// \param coords Coordinates of pixel to get
|
||||
///
|
||||
/// \return Color of the pixel at coordinates (x, y)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfColor sfImage_getPixel(const sfImage* image, unsigned int x, unsigned int y);
|
||||
CSFML_GRAPHICS_API sfColor sfImage_getPixel(const sfImage* image, sfVector2u coords);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get a read-only pointer to the array of pixels of an image
|
||||
@@ -252,7 +271,7 @@ CSFML_GRAPHICS_API sfColor sfImage_getPixel(const sfImage* image, unsigned int x
|
||||
/// \return Read-only pointer to the array of pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API const sfUint8* sfImage_getPixelsPtr(const sfImage* image);
|
||||
CSFML_GRAPHICS_API const uint8_t* sfImage_getPixelsPtr(const sfImage* image);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Flip an image horizontally (left <-> right)
|
||||
@@ -269,6 +288,3 @@ CSFML_GRAPHICS_API void sfImage_flipHorizontally(sfImage* image);
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfImage_flipVertically(sfImage* image);
|
||||
|
||||
|
||||
#endif // SFML_IMAGE_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,33 +22,28 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_PRIMITIVETYPE_H
|
||||
#define SFML_PRIMITIVETYPE_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Graphics/Export.h>
|
||||
#include <CSFML/Graphics/Export.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Types of primitives that a sf::VertexArray can render
|
||||
/// \brief Types of primitives that an sfVertexArray can render
|
||||
///
|
||||
/// Points and lines have no area, therefore their thickness
|
||||
/// will always be 1 pixel, regarldess the current transform
|
||||
/// will always be 1 pixel, regardless the current transform
|
||||
/// and view.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef enum
|
||||
typedef enum
|
||||
{
|
||||
sfPoints, ///< List of individual points
|
||||
sfLines, ///< List of individual lines
|
||||
sfLinesStrip, ///< List of connected lines, a point uses the previous point to form a line
|
||||
sfTriangles, ///< List of individual triangles
|
||||
sfTrianglesStrip, ///< List of connected triangles, a point uses the two previous points to form a triangle
|
||||
sfTrianglesFan, ///< List of connected triangles, a point uses the common center and the previous point to form a triangle
|
||||
sfQuads ///< List of individual quads
|
||||
sfPoints, ///< List of individual points
|
||||
sfLines, ///< List of individual lines
|
||||
sfLineStrip, ///< List of connected lines, a point uses the previous point to form a line
|
||||
sfTriangles, ///< List of individual triangles
|
||||
sfTriangleStrip, ///< List of connected triangles, a point uses the two previous points to form a triangle
|
||||
sfTriangleFan, ///< List of connected triangles, a point uses the common center and the previous point to form a triangle
|
||||
} sfPrimitiveType;
|
||||
|
||||
|
||||
#endif // SFML_BLENDMODE_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,13 +22,14 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_RECT_H
|
||||
#define SFML_RECT_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Graphics/Export.h>
|
||||
#include <CSFML/Graphics/Export.h>
|
||||
|
||||
#include <CSFML/System/Vector2.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -37,32 +38,27 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
float left;
|
||||
float top;
|
||||
float width;
|
||||
float height;
|
||||
sfVector2f position;
|
||||
sfVector2f size;
|
||||
} sfFloatRect;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int left;
|
||||
int top;
|
||||
int width;
|
||||
int height;
|
||||
sfVector2i position;
|
||||
sfVector2i size;
|
||||
} sfIntRect;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check if a point is inside a rectangle's area
|
||||
///
|
||||
/// \param rect Rectangle to test
|
||||
/// \param x X coordinate of the point to test
|
||||
/// \param y Y coordinate of the point to test
|
||||
/// \param rect Rectangle to test
|
||||
/// \param point Coordinates of the point to test
|
||||
///
|
||||
/// \return sfTrue if the point is inside
|
||||
/// \return true if the point is inside
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfBool sfFloatRect_contains(const sfFloatRect* rect, float x, float y);
|
||||
CSFML_GRAPHICS_API sfBool sfIntRect_contains(const sfIntRect* rect, int x, int y);
|
||||
CSFML_GRAPHICS_API bool sfFloatRect_contains(const sfFloatRect* rect, sfVector2f point);
|
||||
CSFML_GRAPHICS_API bool sfIntRect_contains(const sfIntRect* rect, sfVector2i point);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check intersection between two rectangles
|
||||
@@ -71,11 +67,8 @@ CSFML_GRAPHICS_API sfBool sfIntRect_contains(const sfIntRect* rect, int x, int y
|
||||
/// \param rect2 Second rectangle to test
|
||||
/// \param intersection Rectangle to be filled with overlapping rect (can be NULL)
|
||||
///
|
||||
/// \return sfTrue if rectangles overlap
|
||||
/// \return true if rectangles overlap
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfBool sfFloatRect_intersects(const sfFloatRect* rect1, const sfFloatRect* rect2, sfFloatRect* intersection);
|
||||
CSFML_GRAPHICS_API sfBool sfIntRect_intersects(const sfIntRect* rect1, const sfIntRect* rect2, sfIntRect* intersection);
|
||||
|
||||
|
||||
#endif // SFML_RECT_H
|
||||
CSFML_GRAPHICS_API bool sfFloatRect_intersects(const sfFloatRect* rect1, const sfFloatRect* rect2, sfFloatRect* intersection);
|
||||
CSFML_GRAPHICS_API bool sfIntRect_intersects(const sfIntRect* rect1, const sfIntRect* rect2, sfIntRect* intersection);
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,17 +22,20 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_RECTANGLESHAPE_H
|
||||
#define SFML_RECTANGLESHAPE_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Graphics/Export.h>
|
||||
#include <SFML/Graphics/Color.h>
|
||||
#include <SFML/Graphics/Rect.h>
|
||||
#include <SFML/Graphics/Types.h>
|
||||
#include <SFML/System/Vector2.h>
|
||||
#include <CSFML/Graphics/Export.h>
|
||||
|
||||
#include <CSFML/Graphics/Color.h>
|
||||
#include <CSFML/Graphics/Rect.h>
|
||||
#include <CSFML/Graphics/Transform.h>
|
||||
#include <CSFML/Graphics/Types.h>
|
||||
#include <CSFML/System/Vector2.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -41,7 +44,7 @@
|
||||
/// \return A new sfRectangleShape object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfRectangleShape* sfRectangleShape_Create(void);
|
||||
CSFML_GRAPHICS_API sfRectangleShape* sfRectangleShape_create(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Copy an existing rectangle shape
|
||||
@@ -51,54 +54,54 @@ CSFML_GRAPHICS_API sfRectangleShape* sfRectangleShape_Create(void);
|
||||
/// \return Copied object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfRectangleShape* sfRectangleShape_Copy(sfRectangleShape* shape);
|
||||
CSFML_GRAPHICS_API sfRectangleShape* sfRectangleShape_copy(const sfRectangleShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destroy an existing rectangle shape
|
||||
///
|
||||
/// \param Shape Shape to delete
|
||||
/// \param shape Shape to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRectangleShape_Destroy(sfRectangleShape* shape);
|
||||
CSFML_GRAPHICS_API void sfRectangleShape_destroy(const sfRectangleShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the position of a rectangle shape
|
||||
///
|
||||
/// This function completely overwrites the previous position.
|
||||
/// See sfRectangleShape_Move to apply an offset based on the previous position instead.
|
||||
/// See sfRectangleShape_move to apply an offset based on the previous position instead.
|
||||
/// The default position of a circle Shape object is (0, 0).
|
||||
///
|
||||
/// \param shape Shape object
|
||||
/// \param position New position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRectangleShape_SetPosition(sfRectangleShape* shape, sfVector2f position);
|
||||
CSFML_GRAPHICS_API void sfRectangleShape_setPosition(sfRectangleShape* shape, sfVector2f position);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the orientation of a rectangle shape
|
||||
///
|
||||
/// This function completely overwrites the previous rotation.
|
||||
/// See sfRectangleShape_Rotate to add an angle based on the previous rotation instead.
|
||||
/// See sfRectangleShape_rotate to add an angle based on the previous rotation instead.
|
||||
/// The default rotation of a circle Shape object is 0.
|
||||
///
|
||||
/// \param shape Shape object
|
||||
/// \param angle New rotation, in degrees
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRectangleShape_SetRotation(sfRectangleShape* shape, float angle);
|
||||
CSFML_GRAPHICS_API void sfRectangleShape_setRotation(sfRectangleShape* shape, float angle);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the scale factors of a rectangle shape
|
||||
///
|
||||
/// This function completely overwrites the previous scale.
|
||||
/// See sfRectangleShape_Scale to add a factor based on the previous scale instead.
|
||||
/// See sfRectangleShape_scale to add a factor based on the previous scale instead.
|
||||
/// The default scale of a circle Shape object is (1, 1).
|
||||
///
|
||||
/// \param shape Shape object
|
||||
/// \param scale New scale factors
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRectangleShape_SetScale(sfRectangleShape* shape, sfVector2f scale);
|
||||
CSFML_GRAPHICS_API void sfRectangleShape_setScale(sfRectangleShape* shape, sfVector2f scale);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the local origin of a rectangle shape
|
||||
@@ -114,7 +117,7 @@ CSFML_GRAPHICS_API void sfRectangleShape_SetScale(sfRectangleShape* shape, sfVec
|
||||
/// \param origin New origin
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRectangleShape_SetOrigin(sfRectangleShape* shape, sfVector2f origin);
|
||||
CSFML_GRAPHICS_API void sfRectangleShape_setOrigin(sfRectangleShape* shape, sfVector2f origin);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the position of a rectangle shape
|
||||
@@ -124,7 +127,7 @@ CSFML_GRAPHICS_API void sfRectangleShape_SetOrigin(sfRectangleShape* shape, sfVe
|
||||
/// \return Current position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2f sfRectangleShape_GetPosition(const sfRectangleShape* shape);
|
||||
CSFML_GRAPHICS_API sfVector2f sfRectangleShape_getPosition(const sfRectangleShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the orientation of a rectangle shape
|
||||
@@ -136,7 +139,7 @@ CSFML_GRAPHICS_API sfVector2f sfRectangleShape_GetPosition(const sfRectangleShap
|
||||
/// \return Current rotation, in degrees
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API float sfRectangleShape_GetRotation(const sfRectangleShape* shape);
|
||||
CSFML_GRAPHICS_API float sfRectangleShape_getRotation(const sfRectangleShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current scale of a rectangle shape
|
||||
@@ -146,7 +149,7 @@ CSFML_GRAPHICS_API float sfRectangleShape_GetRotation(const sfRectangleShape* sh
|
||||
/// \return Current scale factors
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2f sfRectangleShape_GetScale(const sfRectangleShape* shape);
|
||||
CSFML_GRAPHICS_API sfVector2f sfRectangleShape_getScale(const sfRectangleShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the local origin of a rectangle shape
|
||||
@@ -156,43 +159,43 @@ CSFML_GRAPHICS_API sfVector2f sfRectangleShape_GetScale(const sfRectangleShape*
|
||||
/// \return Current origin
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2f sfRectangleShape_GetOrigin(const sfRectangleShape* shape);
|
||||
CSFML_GRAPHICS_API sfVector2f sfRectangleShape_getOrigin(const sfRectangleShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Move a rectangle shape by a given offset
|
||||
///
|
||||
/// This function adds to the current position of the object,
|
||||
/// unlike sfRectangleShape_SetPosition which overwrites it.
|
||||
/// unlike sfRectangleShape_setPosition which overwrites it.
|
||||
///
|
||||
/// \param shape Shape object
|
||||
/// \param offset Offset
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRectangleShape_Move(sfRectangleShape* shape, sfVector2f offset);
|
||||
CSFML_GRAPHICS_API void sfRectangleShape_move(sfRectangleShape* shape, sfVector2f offset);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Rotate a rectangle shape
|
||||
///
|
||||
/// This function adds to the current rotation of the object,
|
||||
/// unlike sfRectangleShape_SetRotation which overwrites it.
|
||||
/// unlike sfRectangleShape_setRotation which overwrites it.
|
||||
///
|
||||
/// \param shape Shape object
|
||||
/// \param angle Angle of rotation, in degrees
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRectangleShape_Rotate(sfRectangleShape* shape, float angle);
|
||||
CSFML_GRAPHICS_API void sfRectangleShape_rotate(sfRectangleShape* shape, float angle);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Scale a rectangle shape
|
||||
///
|
||||
/// This function multiplies the current scale of the object,
|
||||
/// unlike sfRectangleShape_SetScale which overwrites it.
|
||||
/// unlike sfRectangleShape_setScale which overwrites it.
|
||||
///
|
||||
/// \param shape Shape object
|
||||
/// \param factors Scale factors
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRectangleShape_Scale(sfRectangleShape* shape, sfVector2f factors);
|
||||
CSFML_GRAPHICS_API void sfRectangleShape_scale(sfRectangleShape* shape, sfVector2f factors);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the combined transform of a rectangle shape
|
||||
@@ -202,7 +205,7 @@ CSFML_GRAPHICS_API void sfRectangleShape_Scale(sfRectangleShape* shape, sfVector
|
||||
/// \return Transform combining the position/rotation/scale/origin of the object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API const sfTransform* sfRectangleShape_GetTransform(const sfRectangleShape* shape);
|
||||
CSFML_GRAPHICS_API sfTransform sfRectangleShape_getTransform(const sfRectangleShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the inverse of the combined transform of a rectangle shape
|
||||
@@ -212,7 +215,7 @@ CSFML_GRAPHICS_API const sfTransform* sfRectangleShape_GetTransform(const sfRect
|
||||
/// \return Inverse of the combined transformations applied to the object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API const sfTransform* sfRectangleShape_GetInverseTransform(const sfRectangleShape* shape);
|
||||
CSFML_GRAPHICS_API sfTransform sfRectangleShape_getInverseTransform(const sfRectangleShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change the source texture of a rectangle shape
|
||||
@@ -233,7 +236,7 @@ CSFML_GRAPHICS_API const sfTransform* sfRectangleShape_GetInverseTransform(const
|
||||
/// \param resetRect Should the texture rect be reset to the size of the new texture?
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRectangleShape_SetTexture(sfRectangleShape* shape, const sfTexture* texture, sfBool resetRect);
|
||||
CSFML_GRAPHICS_API void sfRectangleShape_setTexture(sfRectangleShape* shape, const sfTexture* texture, bool resetRect);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the sub-rectangle of the texture that a rectangle shape will display
|
||||
@@ -246,7 +249,7 @@ CSFML_GRAPHICS_API void sfRectangleShape_SetTexture(sfRectangleShape* shape, con
|
||||
/// \param rect Rectangle defining the region of the texture to display
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRectangleShape_SetTextureRect(sfRectangleShape* shape, sfIntRect rect);
|
||||
CSFML_GRAPHICS_API void sfRectangleShape_setTextureRect(sfRectangleShape* shape, sfIntRect rect);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the fill color of a rectangle shape
|
||||
@@ -262,7 +265,7 @@ CSFML_GRAPHICS_API void sfRectangleShape_SetTextureRect(sfRectangleShape* shape,
|
||||
/// \param color New color of the shape
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRectangleShape_SetFillColor(sfRectangleShape* shape, sfColor color);
|
||||
CSFML_GRAPHICS_API void sfRectangleShape_setFillColor(sfRectangleShape* shape, sfColor color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the outline color of a rectangle shape
|
||||
@@ -274,7 +277,7 @@ CSFML_GRAPHICS_API void sfRectangleShape_SetFillColor(sfRectangleShape* shape, s
|
||||
/// \param color New outline color of the shape
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRectangleShape_SetOutlineColor(sfRectangleShape* shape, sfColor color);
|
||||
CSFML_GRAPHICS_API void sfRectangleShape_setOutlineColor(sfRectangleShape* shape, sfColor color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the thickness of a rectangle shape's outline
|
||||
@@ -287,7 +290,7 @@ CSFML_GRAPHICS_API void sfRectangleShape_SetOutlineColor(sfRectangleShape* shape
|
||||
/// \param thickness New outline thickness
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRectangleShape_SetOutlineThickness(sfRectangleShape* shape, float thickness);
|
||||
CSFML_GRAPHICS_API void sfRectangleShape_setOutlineThickness(sfRectangleShape* shape, float thickness);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the source texture of a rectangle shape
|
||||
@@ -301,7 +304,7 @@ CSFML_GRAPHICS_API void sfRectangleShape_SetOutlineThickness(sfRectangleShape* s
|
||||
/// \return Pointer to the shape's texture
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API const sfTexture* sfRectangleShape_GetTexture(const sfRectangleShape* shape);
|
||||
CSFML_GRAPHICS_API const sfTexture* sfRectangleShape_getTexture(const sfRectangleShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the sub-rectangle of the texture displayed by a rectangle shape
|
||||
@@ -311,7 +314,7 @@ CSFML_GRAPHICS_API const sfTexture* sfRectangleShape_GetTexture(const sfRectangl
|
||||
/// \return Texture rectangle of the shape
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfIntRect sfRectangleShape_GetTextureRect(const sfRectangleShape* shape);
|
||||
CSFML_GRAPHICS_API sfIntRect sfRectangleShape_getTextureRect(const sfRectangleShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the fill color of a rectangle shape
|
||||
@@ -321,7 +324,7 @@ CSFML_GRAPHICS_API sfIntRect sfRectangleShape_GetTextureRect(const sfRectangleSh
|
||||
/// \return Fill color of the shape
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfColor sfRectangleShape_GetFillColor(const sfRectangleShape* shape);
|
||||
CSFML_GRAPHICS_API sfColor sfRectangleShape_getFillColor(const sfRectangleShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the outline color of a rectangle shape
|
||||
@@ -331,7 +334,7 @@ CSFML_GRAPHICS_API sfColor sfRectangleShape_GetFillColor(const sfRectangleShape*
|
||||
/// \return Outline color of the shape
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfColor sfRectangleShape_GetOutlineColor(const sfRectangleShape* shape);
|
||||
CSFML_GRAPHICS_API sfColor sfRectangleShape_getOutlineColor(const sfRectangleShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the outline thickness of a rectangle shape
|
||||
@@ -341,7 +344,7 @@ CSFML_GRAPHICS_API sfColor sfRectangleShape_GetOutlineColor(const sfRectangleSha
|
||||
/// \return Outline thickness of the shape
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API float sfRectangleShape_GetOutlineThickness(const sfRectangleShape* shape);
|
||||
CSFML_GRAPHICS_API float sfRectangleShape_getOutlineThickness(const sfRectangleShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the total number of points of a rectangle shape
|
||||
@@ -351,7 +354,7 @@ CSFML_GRAPHICS_API float sfRectangleShape_GetOutlineThickness(const sfRectangleS
|
||||
/// \return Number of points of the shape
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API unsigned int sfRectangleShape_GetPointCount(const sfRectangleShape* shape);
|
||||
CSFML_GRAPHICS_API size_t sfRectangleShape_getPointCount(const sfRectangleShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get a point of a rectangle shape
|
||||
@@ -359,12 +362,26 @@ CSFML_GRAPHICS_API unsigned int sfRectangleShape_GetPointCount(const sfRectangle
|
||||
/// The result is undefined if \a index is out of the valid range.
|
||||
///
|
||||
/// \param shape Shape object
|
||||
/// \param index Index of the point to get, in range [0 .. GetPointCount() - 1]
|
||||
/// \param index Index of the point to get, in range [0 .. getPointCount() - 1]
|
||||
///
|
||||
/// \return Index-th point of the shape
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2f sfRectangleShape_GetPoint(const sfRectangleShape* shape, unsigned int index);
|
||||
CSFML_GRAPHICS_API sfVector2f sfRectangleShape_getPoint(const sfRectangleShape* shape, size_t index);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the geometric center of the rectangle
|
||||
///
|
||||
/// The returned point is in local coordinates, that is,
|
||||
/// the shape's transforms (position, rotation, scale) are
|
||||
/// not taken into account.
|
||||
///
|
||||
/// \param shape Shape object
|
||||
///
|
||||
/// \return The geometric center of the shape
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2f sfRectangleShape_getGeometricCenter(const sfRectangleShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the size of a rectangle shape
|
||||
@@ -373,17 +390,17 @@ CSFML_GRAPHICS_API sfVector2f sfRectangleShape_GetPoint(const sfRectangleShape*
|
||||
/// \param size New size of the rectangle
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRectangleShape_SetSize(sfRectangleShape* shape, sfVector2f size);
|
||||
CSFML_GRAPHICS_API void sfRectangleShape_setSize(sfRectangleShape* shape, sfVector2f size);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the size of a rectangle shape
|
||||
///
|
||||
/// \param shape Shape object
|
||||
//
|
||||
///
|
||||
/// \return height Size of the rectangle
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2f sfRectangleShape_GetSize(const sfRectangleShape* shape);
|
||||
CSFML_GRAPHICS_API sfVector2f sfRectangleShape_getSize(const sfRectangleShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the local bounding rectangle of a rectangle shape
|
||||
@@ -399,7 +416,7 @@ CSFML_GRAPHICS_API sfVector2f sfRectangleShape_GetSize(const sfRectangleShape* s
|
||||
/// \return Local bounding rectangle of the entity
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfFloatRect sfRectangleShape_GetLocalBounds(const sfRectangleShape* shape);
|
||||
CSFML_GRAPHICS_API sfFloatRect sfRectangleShape_getLocalBounds(const sfRectangleShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the global bounding rectangle of a rectangle shape
|
||||
@@ -415,7 +432,4 @@ CSFML_GRAPHICS_API sfFloatRect sfRectangleShape_GetLocalBounds(const sfRectangle
|
||||
/// \return Global bounding rectangle of the entity
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfFloatRect sfRectangleShape_GetGlobalBounds(const sfRectangleShape* shape);
|
||||
|
||||
|
||||
#endif // SFML_RECTANGLESHAPE_H
|
||||
CSFML_GRAPHICS_API sfFloatRect sfRectangleShape_getGlobalBounds(const sfRectangleShape* shape);
|
||||
@@ -0,0 +1,57 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <CSFML/Graphics/Export.h>
|
||||
|
||||
#include <CSFML/Graphics/BlendMode.h>
|
||||
#include <CSFML/Graphics/CoordinateType.h>
|
||||
#include <CSFML/Graphics/StencilMode.h>
|
||||
#include <CSFML/Graphics/Transform.h>
|
||||
#include <CSFML/Graphics/Types.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Define the states used for drawing to a RenderTarget
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
sfBlendMode blendMode; ///< Blending mode
|
||||
sfStencilMode stencilMode; //!< Stencil mode
|
||||
sfTransform transform; ///< Transform
|
||||
sfCoordinateType coordinateType; //!< Texture coordinate type
|
||||
const sfTexture* texture; ///< Texture
|
||||
const sfShader* shader; ///< Shader
|
||||
} sfRenderStates;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Define the default values for a RenderState
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API const sfRenderStates sfRenderStates_default;
|
||||
@@ -0,0 +1,436 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <CSFML/Graphics/Export.h>
|
||||
|
||||
#include <CSFML/Graphics/Color.h>
|
||||
#include <CSFML/Graphics/PrimitiveType.h>
|
||||
#include <CSFML/Graphics/Rect.h>
|
||||
#include <CSFML/Graphics/RenderStates.h>
|
||||
#include <CSFML/Graphics/StencilMode.h>
|
||||
#include <CSFML/Graphics/Types.h>
|
||||
#include <CSFML/Graphics/Vertex.h>
|
||||
#include <CSFML/System/Vector2.h>
|
||||
#include <CSFML/Window/Window.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Construct a new render texture
|
||||
///
|
||||
/// \param size Size of the render texture
|
||||
/// \param settings Settings of the render texture
|
||||
///
|
||||
/// \return A new sfRenderTexture object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfRenderTexture* sfRenderTexture_create(sfVector2u size, const sfContextSettings* settings);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destroy an existing render texture
|
||||
///
|
||||
/// \param renderTexture Render texture to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderTexture_destroy(const sfRenderTexture* renderTexture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the size of the rendering region of a render texture
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
///
|
||||
/// \return Size in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2u sfRenderTexture_getSize(const sfRenderTexture* renderTexture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell if the render texture will use sRGB encoding when drawing on it
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
///
|
||||
/// \return true if the render texture use sRGB encoding, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API bool sfRenderTexture_isSrgb(const sfRenderTexture* renderTexture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Activate or deactivate a render texture as the current target for rendering
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
/// \param active true to activate, false to deactivate
|
||||
///
|
||||
/// \return True if operation was successful, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API bool sfRenderTexture_setActive(sfRenderTexture* renderTexture, bool active);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Update the contents of the target texture
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderTexture_display(sfRenderTexture* renderTexture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Clear the rendertexture with the given color
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
/// \param color Fill color
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderTexture_clear(sfRenderTexture* renderTexture, sfColor color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Clear the stencil buffer to a specific value
|
||||
///
|
||||
/// The specified value is truncated to the bit width of
|
||||
/// the current stencil buffer.
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
/// \param stencilValue Stencil value to clear to
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderTexture_clearStencil(sfRenderTexture* renderTexture, sfStencilValue stencilValue);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Clear the entire target with a single color and stencil value
|
||||
///
|
||||
/// The specified stencil value is truncated to the bit
|
||||
/// width of the current stencil buffer.
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
/// \param color Fill color to use to clear the render target
|
||||
/// \param stencilValue Stencil value to clear to
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderTexture_clearColorAndStencil(sfRenderTexture* renderTexture,
|
||||
sfColor color,
|
||||
sfStencilValue stencilValue);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change the current active view of a render texture
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
/// \param view Pointer to the new view
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderTexture_setView(sfRenderTexture* renderTexture, const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current active view of a render texture
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
///
|
||||
/// \return Current active view
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API const sfView* sfRenderTexture_getView(const sfRenderTexture* renderTexture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the default view of a render texture
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
///
|
||||
/// \return Default view of the rendertexture
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API const sfView* sfRenderTexture_getDefaultView(const sfRenderTexture* renderTexture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the viewport of a view applied to this target
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
/// \param view Target view
|
||||
///
|
||||
/// \return Viewport rectangle, expressed in pixels in the current target
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfIntRect sfRenderTexture_getViewport(const sfRenderTexture* renderTexture, const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the scissor rectangle of a view, applied to this render target
|
||||
///
|
||||
/// The scissor rectangle is defined in the view as a ratio. This
|
||||
/// function simply applies this ratio to the current dimensions
|
||||
/// of the render target to calculate the pixels rectangle
|
||||
/// that the scissor rectangle actually covers in the target.
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
/// \param view The view for which we want to compute the scissor rectangle
|
||||
///
|
||||
/// \return Scissor rectangle, expressed in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfIntRect sfRenderTexture_getScissor(const sfRenderTexture* renderTexture, const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Convert a point from texture coordinates to world coordinates
|
||||
///
|
||||
/// This function finds the 2D position that matches the
|
||||
/// given pixel of the render-texture. In other words, it does
|
||||
/// the inverse of what the graphics card does, to find the
|
||||
/// initial position of a rendered pixel.
|
||||
///
|
||||
/// Initially, both coordinate systems (world units and target pixels)
|
||||
/// match perfectly. But if you define a custom view or resize your
|
||||
/// render-texture, this assertion is not true anymore, ie. a point
|
||||
/// located at (10, 50) in your render-texture may map to the point
|
||||
/// (150, 75) in your 2D world -- if the view is translated by (140, 25).
|
||||
///
|
||||
/// This version uses a custom view for calculations, see the other
|
||||
/// overload of the function if you want to use the current view of the
|
||||
/// render-texture.
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
/// \param point Pixel to convert
|
||||
/// \param view The view to use for converting the point
|
||||
///
|
||||
/// \return The converted point, in "world" units
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2f
|
||||
sfRenderTexture_mapPixelToCoords(const sfRenderTexture* renderTexture, sfVector2i point, const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Convert a point from world coordinates to texture coordinates
|
||||
///
|
||||
/// This function finds the pixel of the render-texture that matches
|
||||
/// the given 2D point. In other words, it goes through the same process
|
||||
/// as the graphics card, to compute the final position of a rendered point.
|
||||
///
|
||||
/// Initially, both coordinate systems (world units and target pixels)
|
||||
/// match perfectly. But if you define a custom view or resize your
|
||||
/// render-texture, this assertion is not true anymore, ie. a point
|
||||
/// located at (150, 75) in your 2D world may map to the pixel
|
||||
/// (10, 50) of your render-texture -- if the view is translated by (140, 25).
|
||||
///
|
||||
/// This version uses a custom view for calculations, see the other
|
||||
/// overload of the function if you want to use the current view of the
|
||||
/// render-texture.
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
/// \param point Point to convert
|
||||
/// \param view The view to use for converting the point
|
||||
///
|
||||
/// \return The converted point, in target coordinates (pixels)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2i
|
||||
sfRenderTexture_mapCoordsToPixel(const sfRenderTexture* renderTexture, sfVector2f point, const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Draw a drawable object to the render-target
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
/// \param object Object to draw
|
||||
/// \param states Render states to use for drawing (NULL to use the default states)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderTexture_drawSprite(sfRenderTexture* renderTexture,
|
||||
const sfSprite* object,
|
||||
const sfRenderStates* states);
|
||||
CSFML_GRAPHICS_API void sfRenderTexture_drawText(sfRenderTexture* renderTexture,
|
||||
const sfText* object,
|
||||
const sfRenderStates* states);
|
||||
CSFML_GRAPHICS_API void sfRenderTexture_drawShape(sfRenderTexture* renderTexture,
|
||||
const sfShape* object,
|
||||
const sfRenderStates* states);
|
||||
CSFML_GRAPHICS_API void sfRenderTexture_drawCircleShape(sfRenderTexture* renderTexture,
|
||||
const sfCircleShape* object,
|
||||
const sfRenderStates* states);
|
||||
CSFML_GRAPHICS_API void sfRenderTexture_drawConvexShape(sfRenderTexture* renderTexture,
|
||||
const sfConvexShape* object,
|
||||
const sfRenderStates* states);
|
||||
CSFML_GRAPHICS_API void sfRenderTexture_drawRectangleShape(sfRenderTexture* renderTexture,
|
||||
const sfRectangleShape* object,
|
||||
const sfRenderStates* states);
|
||||
CSFML_GRAPHICS_API void sfRenderTexture_drawVertexArray(sfRenderTexture* renderTexture,
|
||||
const sfVertexArray* object,
|
||||
const sfRenderStates* states);
|
||||
CSFML_GRAPHICS_API void sfRenderTexture_drawVertexBuffer(sfRenderTexture* renderTexture,
|
||||
const sfVertexBuffer* object,
|
||||
const sfRenderStates* states);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Draw primitives defined by a vertex buffer.
|
||||
///
|
||||
/// \param renderTexture render texture object
|
||||
/// \param object Vertex buffer object to draw
|
||||
/// \param firstVertex Index of the first vertex to render
|
||||
/// \param vertexCount Number of vertices to render
|
||||
/// \param states Render states to use for drawing
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderTexture_drawVertexBufferRange(
|
||||
sfRenderTexture* renderTexture,
|
||||
const sfVertexBuffer* object,
|
||||
size_t firstVertex,
|
||||
size_t vertexCount,
|
||||
const sfRenderStates* states);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Draw primitives defined by an array of vertices to a render texture
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
/// \param vertices Pointer to the vertices
|
||||
/// \param vertexCount Number of vertices in the array
|
||||
/// \param type Type of primitives to draw
|
||||
/// \param states Render states to use for drawing (NULL to use the default states)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderTexture_drawPrimitives(
|
||||
sfRenderTexture* renderTexture,
|
||||
const sfVertex* vertices,
|
||||
size_t vertexCount,
|
||||
sfPrimitiveType type,
|
||||
const sfRenderStates* states);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Save the current OpenGL render states and matrices
|
||||
///
|
||||
/// This function can be used when you mix SFML drawing
|
||||
/// and direct OpenGL rendering. Combined with popGLStates,
|
||||
/// it ensures that:
|
||||
/// \li SFML's internal states are not messed up by your OpenGL code
|
||||
/// \li your OpenGL states are not modified by a call to a SFML function
|
||||
///
|
||||
/// Note that this function is quite expensive: it saves all the
|
||||
/// possible OpenGL states and matrices, even the ones you
|
||||
/// don't care about. Therefore it should be used wisely.
|
||||
/// It is provided for convenience, but the best results will
|
||||
/// be achieved if you handle OpenGL states yourself (because
|
||||
/// you know which states have really changed, and need to be
|
||||
/// saved and restored). Take a look at the resetGLStates
|
||||
/// function if you do so.
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderTexture_pushGLStates(sfRenderTexture* renderTexture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Restore the previously saved OpenGL render states and matrices
|
||||
///
|
||||
/// See the description of pushGLStates to get a detailed
|
||||
/// description of these functions.
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderTexture_popGLStates(sfRenderTexture* renderTexture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Reset the internal OpenGL states so that the target is ready for drawing
|
||||
///
|
||||
/// This function can be used when you mix SFML drawing
|
||||
/// and direct OpenGL rendering, if you choose not to use
|
||||
/// pushGLStates/popGLStates. It makes sure that all OpenGL
|
||||
/// states needed by SFML are set, so that subsequent sfRenderTexture_draw*()
|
||||
/// calls will work as expected.
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderTexture_resetGLStates(sfRenderTexture* renderTexture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the target texture of a render texture
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
///
|
||||
/// \return Pointer to the target texture
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API const sfTexture* sfRenderTexture_getTexture(const sfRenderTexture* renderTexture);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the maximum anti-aliasing level supported by the system
|
||||
///
|
||||
/// \return The maximum anti-aliasing level supported by the system
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API unsigned int sfRenderTexture_getMaximumAntiAliasingLevel(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Enable or disable the smooth filter on a render texture
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
/// \param smooth true to enable smoothing, false to disable it
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderTexture_setSmooth(sfRenderTexture* renderTexture, bool smooth);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether the smooth filter is enabled or not for a render texture
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
///
|
||||
/// \return true if smoothing is enabled, false if it is disabled
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API bool sfRenderTexture_isSmooth(const sfRenderTexture* renderTexture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Enable or disable texture repeating
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
/// \param repeated true to enable repeating, false to disable it
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderTexture_setRepeated(sfRenderTexture* renderTexture, bool repeated);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether the texture is repeated or not
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
///
|
||||
/// \return true if repeat mode is enabled, false if it is disabled
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API bool sfRenderTexture_isRepeated(const sfRenderTexture* renderTexture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Generate a mipmap using the current texture data
|
||||
///
|
||||
/// This function is similar to sfTexture_generateMipmap and operates
|
||||
/// on the texture used as the target for drawing.
|
||||
/// Be aware that any draw operation may modify the base level image data.
|
||||
/// For this reason, calling this function only makes sense after all
|
||||
/// drawing is completed and display has been called. Not calling display
|
||||
/// after subsequent drawing will lead to undefined behavior if a mipmap
|
||||
/// had been previously generated.
|
||||
///
|
||||
/// \return true if mipmap generation was successful, false if unsuccessful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API bool sfRenderTexture_generateMipmap(sfRenderTexture* renderTexture);
|
||||
@@ -0,0 +1,707 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <CSFML/Graphics/Export.h>
|
||||
|
||||
#include <CSFML/Graphics/Color.h>
|
||||
#include <CSFML/Graphics/PrimitiveType.h>
|
||||
#include <CSFML/Graphics/Rect.h>
|
||||
#include <CSFML/Graphics/RenderStates.h>
|
||||
#include <CSFML/Graphics/StencilMode.h>
|
||||
#include <CSFML/Graphics/Types.h>
|
||||
#include <CSFML/Graphics/Vertex.h>
|
||||
#include <CSFML/System/Time.h>
|
||||
#include <CSFML/System/Vector2.h>
|
||||
#include <CSFML/Window/Event.h>
|
||||
#include <CSFML/Window/VideoMode.h>
|
||||
#include <CSFML/Window/Window.h>
|
||||
#include <CSFML/Window/WindowHandle.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Construct a new render window
|
||||
///
|
||||
/// \param mode Video mode to use
|
||||
/// \param title Title of the window
|
||||
/// \param style Window style
|
||||
/// \param state Window state
|
||||
/// \param settings Creation settings (pass NULL to use default values)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfRenderWindow* sfRenderWindow_create(
|
||||
sfVideoMode mode,
|
||||
const char* title,
|
||||
uint32_t style,
|
||||
sfWindowState state,
|
||||
const sfContextSettings* settings);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Construct a new render window (with a UTF-32 title)
|
||||
///
|
||||
/// \param mode Video mode to use
|
||||
/// \param title Title of the window (UTF-32)
|
||||
/// \param style Window style
|
||||
/// \param state Window state
|
||||
/// \param settings Creation settings (pass NULL to use default values)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfRenderWindow* sfRenderWindow_createUnicode(
|
||||
sfVideoMode mode,
|
||||
const sfChar32* title,
|
||||
uint32_t style,
|
||||
sfWindowState state,
|
||||
const sfContextSettings* settings);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Construct a render window from an existing control
|
||||
///
|
||||
/// \param handle Platform-specific handle of the control
|
||||
/// \param settings Creation settings (pass NULL to use default values)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfRenderWindow* sfRenderWindow_createFromHandle(sfWindowHandle handle, const sfContextSettings* settings);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destroy an existing render window
|
||||
///
|
||||
/// \param renderWindow Render window to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_destroy(const sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Close a render window (but doesn't destroy the internal data)
|
||||
///
|
||||
/// \param renderWindow Render window to close
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_close(sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether or not a render window is opened
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API bool sfRenderWindow_isOpen(const sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the creation settings of a render window
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
///
|
||||
/// \return Settings used to create the window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfContextSettings sfRenderWindow_getSettings(const sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Pop the event on top of event queue, if any, and return it
|
||||
///
|
||||
/// This function is not blocking: if there's no pending event then
|
||||
/// it will return false and leave \a event unmodified.
|
||||
/// Note that more than one event may be present in the event queue,
|
||||
/// thus you should always call this function in a loop
|
||||
/// to make sure that you process every pending event.
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param event Event to fill, if any
|
||||
///
|
||||
/// \return true if an event was returned, or false if the event queue was empty
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API bool sfRenderWindow_pollEvent(sfRenderWindow* renderWindow, sfEvent* event);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Wait for an event and return it
|
||||
///
|
||||
/// This function is blocking: if there's no pending event then
|
||||
/// it will wait until an event is received or until the provided
|
||||
/// timeout elapses. Only if an error or a timeout occurs the
|
||||
/// function returns `false`.
|
||||
/// This function is typically used when you have a thread that is
|
||||
/// dedicated to events handling: you want to make this thread sleep
|
||||
/// as long as no new event is received.
|
||||
/// \code
|
||||
/// while (sfRenderWindow_waitEvent(renderWindow, timeout, &event))
|
||||
/// {
|
||||
/// // process event...
|
||||
/// }
|
||||
/// \endcode
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param timeout Maximum time to wait (`sfTime_Zero` for infinite)
|
||||
/// \param event Event to fill, if any
|
||||
///
|
||||
/// \return true if an event was returned, false if event queue was empty or function timed out
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API bool sfRenderWindow_waitEvent(sfRenderWindow* renderWindow, sfTime timeout, sfEvent* event);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the position of a render window
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
///
|
||||
/// \return Position in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2i sfRenderWindow_getPosition(const sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change the position of a render window on screen
|
||||
///
|
||||
/// Only works for top-level windows
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param position New position, in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_setPosition(sfRenderWindow* renderWindow, sfVector2i position);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the size of the rendering region of a render window
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
///
|
||||
/// \return Size in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2u sfRenderWindow_getSize(const sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell if the render window will use sRGB encoding when drawing on it
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
///
|
||||
/// \return true if the render window use sRGB encoding, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API bool sfRenderWindow_isSrgb(const sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change the size of the rendering region of a render window
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param size New size, in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_setSize(sfRenderWindow* renderWindow, sfVector2u size);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change the title of a render window
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param title New title
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_setTitle(sfRenderWindow* renderWindow, const char* title);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change the title of a render window (with a UTF-32 string)
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param title New title
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_setUnicodeTitle(sfRenderWindow* renderWindow, const sfChar32* title);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change a render window's icon
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param size Icon's size, in pixels
|
||||
/// \param pixels Pointer to the pixels in memory, format must be RGBA 32 bits
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_setIcon(sfRenderWindow* renderWindow, sfVector2u size, const uint8_t* pixels);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Show or hide a render window
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param visible true to show the window, false to hide it
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_setVisible(sfRenderWindow* renderWindow, bool visible);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Enable / disable vertical synchronization on a render window
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param enabled true to enable v-sync, false to deactivate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_setVerticalSyncEnabled(sfRenderWindow* renderWindow, bool enabled);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Show or hide the mouse cursor on a render window
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param show true to show, false to hide
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_setMouseCursorVisible(sfRenderWindow* renderWindow, bool show);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Grab or release the mouse cursor
|
||||
///
|
||||
/// If set, grabs the mouse cursor inside this window's client
|
||||
/// area so it may no longer be moved outside its bounds.
|
||||
/// Note that grabbing is only active while the window has
|
||||
/// focus and calling this function for fullscreen windows
|
||||
/// won't have any effect (fullscreen windows always grab the
|
||||
/// cursor).
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param grabbed true to enable, false to disable
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_setMouseCursorGrabbed(sfRenderWindow* renderWindow, bool grabbed);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the displayed cursor to a native system cursor
|
||||
///
|
||||
/// Upon window creation, the arrow cursor is used by default.
|
||||
///
|
||||
/// \warning The cursor must not be destroyed while in use by
|
||||
/// the window.
|
||||
///
|
||||
/// \warning Features related to Cursor are not supported on
|
||||
/// iOS and Android.
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param cursor Native system cursor type to display
|
||||
///
|
||||
/// \see sfCursor_createFromSystem
|
||||
/// \see sfCursor_createFromPixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_setMouseCursor(sfRenderWindow* renderWindow, const sfCursor* cursor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Enable or disable automatic key-repeat for keydown events
|
||||
///
|
||||
/// Automatic key-repeat is enabled by default
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param enabled true to enable, false to disable
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_setKeyRepeatEnabled(sfRenderWindow* renderWindow, bool enabled);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Limit the framerate to a maximum fixed frequency for a render window
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param limit Framerate limit, in frames per seconds (use 0 to disable limit)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_setFramerateLimit(sfRenderWindow* renderWindow, unsigned int limit);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change the joystick threshold, ie. the value below which no move event will be generated
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param threshold New threshold, in range [0, 100]
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_setJoystickThreshold(sfRenderWindow* renderWindow, float threshold);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Activate or deactivate a render window as the current target for rendering
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param active true to activate, false to deactivate
|
||||
///
|
||||
/// \return True if operation was successful, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API bool sfRenderWindow_setActive(sfRenderWindow* renderWindow, bool active);
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
/// \brief Request the current render window to be made the active
|
||||
/// foreground window
|
||||
///
|
||||
/// At any given time, only one window may have the input focus
|
||||
/// to receive input events such as keystrokes or mouse events.
|
||||
/// If a window requests focus, it only hints to the operating
|
||||
/// system, that it would like to be focused. The operating system
|
||||
/// is free to deny the request.
|
||||
/// This is not to be confused with sfWindow_setActive().
|
||||
///
|
||||
///////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_requestFocus(sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check whether the render window has the input focus
|
||||
///
|
||||
/// At any given time, only one window may have the input focus
|
||||
/// to receive input events such as keystrokes or most mouse
|
||||
/// events.
|
||||
///
|
||||
/// \return True if window has focus, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API bool sfRenderWindow_hasFocus(const sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Display a render window on screen
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_display(sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Retrieve the OS-specific handle of a render window
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
///
|
||||
/// \return Window handle
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfWindowHandle sfRenderWindow_getNativeHandle(const sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Clear a render window with the given color
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param color Fill color
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_clear(sfRenderWindow* renderWindow, sfColor color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Clear the stencil buffer to a specific value
|
||||
///
|
||||
/// The specified value is truncated to the bit width of
|
||||
/// the current stencil buffer.
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param stencilValue Stencil value to clear to
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_clearStencil(sfRenderWindow* renderWindow, sfStencilValue stencilValue);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Clear the entire target with a single color and stencil value
|
||||
///
|
||||
/// The specified stencil value is truncated to the bit
|
||||
/// width of the current stencil buffer.
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param color Fill color to use to clear the render target
|
||||
/// \param stencilValue Stencil value to clear to
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_clearColorAndStencil(sfRenderWindow* renderWindow, sfColor color, sfStencilValue stencilValue);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change the current active view of a render window
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param view Pointer to the new view
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_setView(sfRenderWindow* renderWindow, const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current active view of a render window
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
///
|
||||
/// \return Current active view
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API const sfView* sfRenderWindow_getView(const sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the default view of a render window
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
///
|
||||
/// \return Default view of the render window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API const sfView* sfRenderWindow_getDefaultView(const sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the viewport of a view applied to this target
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param view Target view
|
||||
///
|
||||
/// \return Viewport rectangle, expressed in pixels in the current target
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfIntRect sfRenderWindow_getViewport(const sfRenderWindow* renderWindow, const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the scissor rectangle of a view, applied to this render target
|
||||
///
|
||||
/// The scissor rectangle is defined in the view as a ratio. This
|
||||
/// function simply applies this ratio to the current dimensions
|
||||
/// of the render target to calculate the pixels rectangle
|
||||
/// that the scissor rectangle actually covers in the target.
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param view The view for which we want to compute the scissor rectangle
|
||||
///
|
||||
/// \return Scissor rectangle, expressed in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfIntRect sfRenderWindow_getScissor(const sfRenderWindow* renderWindow, const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Convert a point from window coordinates to world coordinates
|
||||
///
|
||||
/// This function finds the 2D position that matches the
|
||||
/// given pixel of the render-window. In other words, it does
|
||||
/// the inverse of what the graphics card does, to find the
|
||||
/// initial position of a rendered pixel.
|
||||
///
|
||||
/// Initially, both coordinate systems (world units and target pixels)
|
||||
/// match perfectly. But if you define a custom view or resize your
|
||||
/// render-window, this assertion is not true anymore, ie. a point
|
||||
/// located at (10, 50) in your render-window may map to the point
|
||||
/// (150, 75) in your 2D world -- if the view is translated by (140, 25).
|
||||
///
|
||||
/// This function is typically used to find which point (or object) is
|
||||
/// located below the mouse cursor.
|
||||
///
|
||||
/// This version uses a custom view for calculations, see the other
|
||||
/// overload of the function if you want to use the current view of the
|
||||
/// render-window.
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param point Pixel to convert
|
||||
/// \param view The view to use for converting the point
|
||||
///
|
||||
/// \return The converted point, in "world" units
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2f
|
||||
sfRenderWindow_mapPixelToCoords(const sfRenderWindow* renderWindow, sfVector2i point, const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Convert a point from world coordinates to window coordinates
|
||||
///
|
||||
/// This function finds the pixel of the render-window that matches
|
||||
/// the given 2D point. In other words, it goes through the same process
|
||||
/// as the graphics card, to compute the final position of a rendered point.
|
||||
///
|
||||
/// Initially, both coordinate systems (world units and target pixels)
|
||||
/// match perfectly. But if you define a custom view or resize your
|
||||
/// render-window, this assertion is not true anymore, ie. a point
|
||||
/// located at (150, 75) in your 2D world may map to the pixel
|
||||
/// (10, 50) of your render-window -- if the view is translated by (140, 25).
|
||||
///
|
||||
/// This version uses a custom view for calculations, see the other
|
||||
/// overload of the function if you want to use the current view of the
|
||||
/// render-window.
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param point Point to convert
|
||||
/// \param view The view to use for converting the point
|
||||
///
|
||||
/// \return The converted point, in target coordinates (pixels)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2i
|
||||
sfRenderWindow_mapCoordsToPixel(const sfRenderWindow* renderWindow, sfVector2f point, const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Draw a drawable object to the render-target
|
||||
///
|
||||
/// \param renderWindow render window object
|
||||
/// \param object Object to draw
|
||||
/// \param states Render states to use for drawing (NULL to use the default states)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_drawSprite(sfRenderWindow* renderWindow,
|
||||
const sfSprite* object,
|
||||
const sfRenderStates* states);
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_drawText(sfRenderWindow* renderWindow, const sfText* object, const sfRenderStates* states);
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_drawShape(sfRenderWindow* renderWindow, const sfShape* object, const sfRenderStates* states);
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_drawCircleShape(sfRenderWindow* renderWindow,
|
||||
const sfCircleShape* object,
|
||||
const sfRenderStates* states);
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_drawConvexShape(sfRenderWindow* renderWindow,
|
||||
const sfConvexShape* object,
|
||||
const sfRenderStates* states);
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_drawRectangleShape(sfRenderWindow* renderWindow,
|
||||
const sfRectangleShape* object,
|
||||
const sfRenderStates* states);
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_drawVertexArray(sfRenderWindow* renderWindow,
|
||||
const sfVertexArray* object,
|
||||
const sfRenderStates* states);
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_drawVertexBuffer(sfRenderWindow* renderWindow,
|
||||
const sfVertexBuffer* object,
|
||||
const sfRenderStates* states);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Draw primitives defined by a vertex buffer.
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param object Vertex buffer object to draw
|
||||
/// \param firstVertex Index of the first vertex to render
|
||||
/// \param vertexCount Number of vertices to render
|
||||
/// \param states Render states to use for drawing
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_drawVertexBufferRange(
|
||||
sfRenderWindow* renderWindow,
|
||||
const sfVertexBuffer* object,
|
||||
size_t firstVertex,
|
||||
size_t vertexCount,
|
||||
const sfRenderStates* states);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Draw primitives defined by an array of vertices to a render window
|
||||
///
|
||||
/// \param renderWindow render window object
|
||||
/// \param vertices Pointer to the vertices
|
||||
/// \param vertexCount Number of vertices in the array
|
||||
/// \param type Type of primitives to draw
|
||||
/// \param states Render states to use for drawing (NULL to use the default states)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_drawPrimitives(
|
||||
sfRenderWindow* renderWindow,
|
||||
const sfVertex* vertices,
|
||||
size_t vertexCount,
|
||||
sfPrimitiveType type,
|
||||
const sfRenderStates* states);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Save the current OpenGL render states and matrices
|
||||
///
|
||||
/// This function can be used when you mix SFML drawing
|
||||
/// and direct OpenGL rendering. Combined with popGLStates,
|
||||
/// it ensures that:
|
||||
/// \li SFML's internal states are not messed up by your OpenGL code
|
||||
/// \li your OpenGL states are not modified by a call to a SFML function
|
||||
///
|
||||
/// Note that this function is quite expensive: it saves all the
|
||||
/// possible OpenGL states and matrices, even the ones you
|
||||
/// don't care about. Therefore it should be used wisely.
|
||||
/// It is provided for convenience, but the best results will
|
||||
/// be achieved if you handle OpenGL states yourself (because
|
||||
/// you know which states have really changed, and need to be
|
||||
/// saved and restored). Take a look at the resetGLStates
|
||||
/// function if you do so.
|
||||
///
|
||||
/// \param renderWindow render window object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_pushGLStates(sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Restore the previously saved OpenGL render states and matrices
|
||||
///
|
||||
/// See the description of pushGLStates to get a detailed
|
||||
/// description of these functions.
|
||||
///
|
||||
/// \param renderWindow render window object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_popGLStates(sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Reset the internal OpenGL states so that the target is ready for drawing
|
||||
///
|
||||
/// This function can be used when you mix SFML drawing
|
||||
/// and direct OpenGL rendering, if you choose not to use
|
||||
/// pushGLStates/popGLStates. It makes sure that all OpenGL
|
||||
/// states needed by SFML are set, so that subsequent sfRenderWindow_draw*()
|
||||
/// calls will work as expected.
|
||||
///
|
||||
/// \param renderWindow render window object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_resetGLStates(sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current position of the mouse relative to a render-window
|
||||
///
|
||||
/// This function returns the current position of the mouse
|
||||
/// cursor relative to the given render-window, or desktop if NULL is passed.
|
||||
///
|
||||
/// \param relativeTo Reference window
|
||||
///
|
||||
/// \return Position of the mouse cursor, relative to the given render window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2i sfMouse_getPositionRenderWindow(const sfRenderWindow* relativeTo);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the current position of the mouse relative to a render window
|
||||
///
|
||||
/// This function sets the current position of the mouse
|
||||
/// cursor relative to the given render-window, or desktop if NULL is passed.
|
||||
///
|
||||
/// \param position New position of the mouse
|
||||
/// \param relativeTo Reference window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfMouse_setPositionRenderWindow(sfVector2i position, const sfRenderWindow* relativeTo);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current position of a touch in window coordinates
|
||||
///
|
||||
/// This function returns the current touch position
|
||||
/// relative to the given render window, or desktop if NULL is passed.
|
||||
///
|
||||
/// \param finger Finger index
|
||||
/// \param relativeTo Reference window
|
||||
///
|
||||
/// \return Current position of \a finger, or undefined if it's not down
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2i sfTouch_getPositionRenderWindow(unsigned int finger, const sfRenderWindow* relativeTo);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a Vulkan rendering surface
|
||||
///
|
||||
/// \param renderWindow RenderWindow object
|
||||
/// \param instance Vulkan instance
|
||||
/// \param surface Created surface
|
||||
/// \param allocator Allocator to use
|
||||
///
|
||||
/// \return True if surface creation was successful, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API bool sfRenderWindow_createVulkanSurface(
|
||||
sfRenderWindow* renderWindow,
|
||||
const VkInstance* instance,
|
||||
VkSurfaceKHR* surface,
|
||||
const VkAllocationCallbacks* allocator);
|
||||
@@ -0,0 +1,474 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <CSFML/Graphics/Export.h>
|
||||
|
||||
#include <CSFML/Graphics/Color.h>
|
||||
#include <CSFML/Graphics/Glsl.h>
|
||||
#include <CSFML/Graphics/Transform.h>
|
||||
#include <CSFML/Graphics/Types.h>
|
||||
#include <CSFML/System/InputStream.h>
|
||||
#include <CSFML/System/Vector2.h>
|
||||
#include <CSFML/System/Vector3.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Load the vertex, geometry and fragment shaders from files
|
||||
///
|
||||
/// This function loads the vertex, geometry and fragment
|
||||
/// shaders. Pass NULL if you don't want to load
|
||||
/// a specific shader.
|
||||
/// The sources must be text files containing valid shaders
|
||||
/// in GLSL language. GLSL is a C-like language dedicated to
|
||||
/// OpenGL shaders; you'll probably need to read a good documentation
|
||||
/// for it before writing your own shaders.
|
||||
///
|
||||
/// \param vertexShaderFilename Path of the vertex shader file to load, or NULL to skip this shader
|
||||
/// \param geometryShaderFilename Path of the geometry shader file to load, or NULL to skip this shader
|
||||
/// \param fragmentShaderFilename Path of the fragment shader file to load, or NULL to skip this shader
|
||||
///
|
||||
/// \return A new sfShader object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfShader* sfShader_createFromFile(const char* vertexShaderFilename,
|
||||
const char* geometryShaderFilename,
|
||||
const char* fragmentShaderFilename);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Load the vertex, geometry and fragment shaders from source code in memory
|
||||
///
|
||||
/// This function loads the vertex, geometry and fragment
|
||||
/// shaders. Pass NULL if you don't want to load
|
||||
/// a specific shader.
|
||||
/// The sources must be valid shaders in GLSL language. GLSL is
|
||||
/// a C-like language dedicated to OpenGL shaders; you'll
|
||||
/// probably need to read a good documentation for it before
|
||||
/// writing your own shaders.
|
||||
///
|
||||
/// \param vertexShader String containing the source code of the vertex shader, or NULL to skip this shader
|
||||
/// \param geometryShader String containing the source code of the geometry shader, or NULL to skip this shader
|
||||
/// \param fragmentShader String containing the source code of the fragment shader, or NULL to skip this shader
|
||||
///
|
||||
/// \return A new sfShader object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfShader* sfShader_createFromMemory(const char* vertexShader,
|
||||
const char* geometryShader,
|
||||
const char* fragmentShader);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Load the vertex, geometry and fragment shaders from custom streams
|
||||
///
|
||||
/// This function loads the vertex, geometry and fragment
|
||||
/// shaders. Pass NULL if you don't want to load
|
||||
/// a specific shader.
|
||||
/// The source codes must be valid shaders in GLSL language.
|
||||
/// GLSL is a C-like language dedicated to OpenGL shaders;
|
||||
/// you'll probably need to read a good documentation for
|
||||
/// it before writing your own shaders.
|
||||
///
|
||||
/// \param vertexShaderStream Source stream to read the vertex shader from, or NULL to skip this shader
|
||||
/// \param geometryShaderStream Source stream to read the geometry shader from, or NULL to skip this shader
|
||||
/// \param fragmentShaderStream Source stream to read the fragment shader from, or NULL to skip this shader
|
||||
///
|
||||
/// \return A new sfShader object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfShader* sfShader_createFromStream(sfInputStream* vertexShaderStream,
|
||||
sfInputStream* geometryShaderStream,
|
||||
sfInputStream* fragmentShaderStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destroy an existing shader
|
||||
///
|
||||
/// \param shader Shader to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfShader_destroy(const sfShader* shader);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Specify value for \p float uniform
|
||||
///
|
||||
/// \param shader Shader object
|
||||
/// \param name Name of the uniform variable in GLSL
|
||||
/// \param x Value of the float scalar
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfShader_setFloatUniform(sfShader* shader, const char* name, float x);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Specify value for \p vec2 uniform
|
||||
///
|
||||
/// \param shader Shader object
|
||||
/// \param name Name of the uniform variable in GLSL
|
||||
/// \param vector Value of the vec2 vector
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfShader_setVec2Uniform(sfShader* shader, const char* name, sfGlslVec2 vector);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Specify value for \p vec3 uniform
|
||||
///
|
||||
/// \param shader Shader object
|
||||
/// \param name Name of the uniform variable in GLSL
|
||||
/// \param vector Value of the vec3 vector
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfShader_setVec3Uniform(sfShader* shader, const char* name, sfGlslVec3 vector);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Specify value for \p vec4 uniform
|
||||
///
|
||||
/// sfColor objects can be passed to this function via
|
||||
/// the use of sfGlslVec4_fromsfColor(sfColor);
|
||||
///
|
||||
/// \param shader Shader object
|
||||
/// \param name Name of the uniform variable in GLSL
|
||||
/// \param vector Value of the vec4 vector
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfShader_setVec4Uniform(sfShader* shader, const char* name, sfGlslVec4 vector);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Specify value for \p vec4 uniform
|
||||
///
|
||||
/// \param shader Shader object
|
||||
/// \param name Name of the uniform variable in GLSL
|
||||
/// \param color Value of the vec4 vector
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfShader_setColorUniform(sfShader* shader, const char* name, sfColor color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Specify value for \p int uniform
|
||||
///
|
||||
/// \param shader Shader object
|
||||
/// \param name Name of the uniform variable in GLSL
|
||||
/// \param x Value of the integer scalar
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfShader_setIntUniform(sfShader* shader, const char* name, int x);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Specify value for \p ivec2 uniform
|
||||
///
|
||||
/// \param shader Shader object
|
||||
/// \param name Name of the uniform variable in GLSL
|
||||
/// \param vector Value of the ivec2 vector
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfShader_setIvec2Uniform(sfShader* shader, const char* name, sfGlslIvec2 vector);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Specify value for \p ivec3 uniform
|
||||
///
|
||||
/// \param shader Shader object
|
||||
/// \param name Name of the uniform variable in GLSL
|
||||
/// \param vector Value of the ivec3 vector
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfShader_setIvec3Uniform(sfShader* shader, const char* name, sfGlslIvec3 vector);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Specify value for \p ivec4 uniform
|
||||
///
|
||||
/// sfColor objects can be passed to this function via
|
||||
/// the use of sfGlslIvec4_fromsfColor(sfColor);
|
||||
///
|
||||
/// \param shader Shader object
|
||||
/// \param name Name of the uniform variable in GLSL
|
||||
/// \param vector Value of the ivec4 vector
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfShader_setIvec4Uniform(sfShader* shader, const char* name, sfGlslIvec4 vector);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Specify value for \p ivec4 uniform
|
||||
///
|
||||
/// \param shader Shader object
|
||||
/// \param name Name of the uniform variable in GLSL
|
||||
/// \param color Value of the ivec4 vector
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfShader_setIntColorUniform(sfShader* shader, const char* name, sfColor color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Specify value for \p bool uniform
|
||||
///
|
||||
/// \param shader Shader object
|
||||
/// \param name Name of the uniform variable in GLSL
|
||||
/// \param x Value of the bool scalar
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfShader_setBoolUniform(sfShader* shader, const char* name, bool x);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Specify value for \p bvec2 uniform
|
||||
///
|
||||
/// \param shader Shader object
|
||||
/// \param name Name of the uniform variable in GLSL
|
||||
/// \param vector Value of the bvec2 vector
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfShader_setBvec2Uniform(sfShader* shader, const char* name, sfGlslBvec2 vector);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Specify value for \p Bvec3 uniform
|
||||
///
|
||||
/// \param shader Shader object
|
||||
/// \param name Name of the uniform variable in GLSL
|
||||
/// \param vector Value of the Bvec3 vector
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfShader_setBvec3Uniform(sfShader* shader, const char* name, sfGlslBvec3 vector);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Specify value for \p bvec4 uniform
|
||||
///
|
||||
/// sfColor objects can be passed to this function via
|
||||
/// the use of sfGlslIvec4_fromsfColor(sfColor);
|
||||
///
|
||||
/// \param shader Shader object
|
||||
/// \param name Name of the uniform variable in GLSL
|
||||
/// \param vector Value of the bvec4 vector
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfShader_setBvec4Uniform(sfShader* shader, const char* name, sfGlslBvec4 vector);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Specify value for \p mat3 matrix
|
||||
///
|
||||
/// \param shader Shader object
|
||||
/// \param name Name of the uniform variable in GLSL
|
||||
/// \param matrix Value of the mat3 matrix
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfShader_setMat3Uniform(sfShader* shader, const char* name, const sfGlslMat3* matrix);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Specify value for \p mat4 matrix
|
||||
///
|
||||
/// \param shader Shader object
|
||||
/// \param name Name of the uniform variable in GLSL
|
||||
/// \param matrix Value of the mat4 matrix
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfShader_setMat4Uniform(sfShader* shader, const char* name, const sfGlslMat4* matrix);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Specify a texture as \p sampler2D uniform
|
||||
///
|
||||
/// \a name is the name of the variable to change in the shader.
|
||||
/// The corresponding parameter in the shader must be a 2D texture
|
||||
/// (\p sampler2D GLSL type).
|
||||
///
|
||||
/// Example:
|
||||
/// \code
|
||||
/// uniform sampler2D the_texture; // this is the variable in the shader
|
||||
/// \endcode
|
||||
/// \code
|
||||
/// sfTexture texture;
|
||||
/// ...
|
||||
/// sfShader_setTextureUniform(shader, "the_texture", &texture);
|
||||
/// \endcode
|
||||
/// It is important to note that \a texture must remain alive as long
|
||||
/// as the shader uses it, no copy is made internally.
|
||||
///
|
||||
/// To use the texture of the object being drawn, which cannot be
|
||||
/// known in advance, you can pass the special value
|
||||
/// sf::Shader::CurrentTexture:
|
||||
/// \code
|
||||
/// shader.setUniform("the_texture", sf::Shader::CurrentTexture).
|
||||
/// \endcode
|
||||
///
|
||||
/// \param shader Shader object
|
||||
/// \param name Name of the texture in the shader
|
||||
/// \param texture Texture to assign
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfShader_setTextureUniform(sfShader* shader, const char* name, const sfTexture* texture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Specify current texture as \p sampler2D uniform
|
||||
///
|
||||
/// This overload maps a shader texture variable to the
|
||||
/// texture of the object being drawn, which cannot be
|
||||
/// known in advance.
|
||||
/// The corresponding parameter in the shader must be a 2D texture
|
||||
/// (\p sampler2D GLSL type).
|
||||
///
|
||||
/// Example:
|
||||
/// \code
|
||||
/// uniform sampler2D current; // this is the variable in the shader
|
||||
/// \endcode
|
||||
/// \code
|
||||
/// sfShader_setCurrentTextureUniform(shader, "current");
|
||||
/// \endcode
|
||||
///
|
||||
/// \param shader Shader object
|
||||
/// \param name Name of the texture in the shader
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfShader_setCurrentTextureUniform(sfShader* shader, const char* name);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Specify values for \p float[] array uniform
|
||||
///
|
||||
/// \param shader Shader object
|
||||
/// \param name Name of the uniform variable in GLSL
|
||||
/// \param scalarArray pointer to array of \p float values
|
||||
/// \param length Number of elements in the array
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfShader_setFloatUniformArray(sfShader* shader, const char* name, const float* scalarArray, size_t length);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Specify values for \p vec2[] array uniform
|
||||
///
|
||||
/// \param shader Shader object
|
||||
/// \param name Name of the uniform variable in GLSL
|
||||
/// \param vectorArray pointer to array of \p vec2 values
|
||||
/// \param length Number of elements in the array
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfShader_setVec2UniformArray(sfShader* shader, const char* name, const sfGlslVec2* vectorArray, size_t length);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Specify values for \p vec3[] array uniform
|
||||
///
|
||||
/// \param shader Shader object
|
||||
/// \param name Name of the uniform variable in GLSL
|
||||
/// \param vectorArray pointer to array of \p vec3 values
|
||||
/// \param length Number of elements in the array
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfShader_setVec3UniformArray(sfShader* shader, const char* name, const sfGlslVec3* vectorArray, size_t length);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Specify values for \p vec4[] array uniform
|
||||
///
|
||||
/// \param shader Shader object
|
||||
/// \param name Name of the uniform variable in GLSL
|
||||
/// \param vectorArray pointer to array of \p vec4 values
|
||||
/// \param length Number of elements in the array
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfShader_setVec4UniformArray(sfShader* shader, const char* name, const sfGlslVec4* vectorArray, size_t length);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Specify values for \p mat3[] array uniform
|
||||
///
|
||||
/// \param shader Shader object
|
||||
/// \param name Name of the uniform variable in GLSL
|
||||
/// \param matrixArray pointer to array of \p mat3 values
|
||||
/// \param length Number of elements in the array
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfShader_setMat3UniformArray(sfShader* shader, const char* name, const sfGlslMat3* matrixArray, size_t length);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Specify values for \p mat4[] array uniform
|
||||
///
|
||||
/// \param shader Shader object
|
||||
/// \param name Name of the uniform variable in GLSL
|
||||
/// \param matrixArray pointer to array of \p mat4 values
|
||||
/// \param length Number of elements in the array
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfShader_setMat4UniformArray(sfShader* shader, const char* name, const sfGlslMat4* matrixArray, size_t length);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the underlying OpenGL handle of the shader.
|
||||
///
|
||||
/// You shouldn't need to use this function, unless you have
|
||||
/// very specific stuff to implement that SFML doesn't support,
|
||||
/// or implement a temporary workaround until a bug is fixed.
|
||||
///
|
||||
/// \param shader Shader object
|
||||
///
|
||||
/// \return OpenGL handle of the shader or 0 if not yet loaded
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API unsigned int sfShader_getNativeHandle(const sfShader* shader);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Bind a shader for rendering (activate it)
|
||||
///
|
||||
/// This function is not part of the graphics API, it mustn't be
|
||||
/// used when drawing SFML entities. It must be used only if you
|
||||
/// mix sfShader with OpenGL code.
|
||||
///
|
||||
/// \code
|
||||
/// sfShader *s1, *s2;
|
||||
/// ...
|
||||
/// sfShader_bind(s1);
|
||||
/// // draw OpenGL stuff that use s1...
|
||||
/// sfShader_bind(s2);
|
||||
/// // draw OpenGL stuff that use s2...
|
||||
/// sfShader_bind(0);
|
||||
/// // draw OpenGL stuff that use no shader...
|
||||
/// \endcode
|
||||
///
|
||||
/// \param shader Shader to bind, can be null to use no shader
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfShader_bind(const sfShader* shader);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether or not the system supports shaders
|
||||
///
|
||||
/// This function should always be called before using
|
||||
/// the shader features. If it returns false, then
|
||||
/// any attempt to use sfShader will fail.
|
||||
///
|
||||
/// \return true if the system can use shaders, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API bool sfShader_isAvailable(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether or not the system supports geometry shaders
|
||||
///
|
||||
/// This function should always be called before using
|
||||
/// the geometry shader features. If it returns false, then
|
||||
/// any attempt to use sfShader geometry shader features will fail.
|
||||
///
|
||||
/// This function can only return true if isAvailable() would also
|
||||
/// return true, since shaders in general have to be supported in
|
||||
/// order for geometry shaders to be supported as well.
|
||||
///
|
||||
/// Note: The first call to this function, whether by your
|
||||
/// code or SFML will result in a context switch.
|
||||
///
|
||||
/// \return True if geometry shaders are supported, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API bool sfShader_isGeometryAvailable(void);
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,21 +22,24 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SHAPE_H
|
||||
#define SFML_SHAPE_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Graphics/Export.h>
|
||||
#include <SFML/Graphics/Color.h>
|
||||
#include <SFML/Graphics/Rect.h>
|
||||
#include <SFML/Graphics/Types.h>
|
||||
#include <SFML/System/Vector2.h>
|
||||
#include <CSFML/Graphics/Export.h>
|
||||
|
||||
#include <CSFML/Graphics/Color.h>
|
||||
#include <CSFML/Graphics/Rect.h>
|
||||
#include <CSFML/Graphics/Transform.h>
|
||||
#include <CSFML/Graphics/Types.h>
|
||||
#include <CSFML/System/Vector2.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
typedef unsigned int (*sfShapeGetPointCountCallback)(void*); ///< Type of the callback used to get the number of points in a shape
|
||||
typedef sfVector2f (*sfShapeGetPointCallback)(unsigned int, void*); ///< Type of the callback used to get a point of a shape
|
||||
typedef size_t (*sfShapeGetPointCountCallback)(void*); ///< Type of the callback used to get the number of points in a shape
|
||||
typedef sfVector2f (*sfShapeGetPointCallback)(size_t, void*); ///< Type of the callback used to get a point of a shape
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new shape
|
||||
@@ -49,16 +52,16 @@ typedef sfVector2f (*sfShapeGetPointCallback)(unsigned int, void*); ///< Type of
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfShape* sfShape_create(sfShapeGetPointCountCallback getPointCount,
|
||||
sfShapeGetPointCallback getPoint,
|
||||
void* userData);
|
||||
sfShapeGetPointCallback getPoint,
|
||||
void* userData);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destroy an existing shape
|
||||
///
|
||||
/// \param Shape Shape to delete
|
||||
/// \param shape Shape to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfShape_destroy(sfShape* shape);
|
||||
CSFML_GRAPHICS_API void sfShape_destroy(const sfShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the position of a shape
|
||||
@@ -201,7 +204,7 @@ CSFML_GRAPHICS_API void sfShape_scale(sfShape* shape, sfVector2f factors);
|
||||
/// \return Transform combining the position/rotation/scale/origin of the object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API const sfTransform* sfShape_getTransform(const sfShape* shape);
|
||||
CSFML_GRAPHICS_API sfTransform sfShape_getTransform(const sfShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the inverse of the combined transform of a shape
|
||||
@@ -211,7 +214,7 @@ CSFML_GRAPHICS_API const sfTransform* sfShape_getTransform(const sfShape* shape)
|
||||
/// \return Inverse of the combined transformations applied to the object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API const sfTransform* sfShape_getInverseTransform(const sfShape* shape);
|
||||
CSFML_GRAPHICS_API sfTransform sfShape_getInverseTransform(const sfShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change the source texture of a shape
|
||||
@@ -232,7 +235,7 @@ CSFML_GRAPHICS_API const sfTransform* sfShape_getInverseTransform(const sfShape*
|
||||
/// \param resetRect Should the texture rect be reset to the size of the new texture?
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfShape_setTexture(sfShape* shape, const sfTexture* texture, sfBool resetRect);
|
||||
CSFML_GRAPHICS_API void sfShape_setTexture(sfShape* shape, const sfTexture* texture, bool resetRect);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the sub-rectangle of the texture that a shape will display
|
||||
@@ -350,7 +353,7 @@ CSFML_GRAPHICS_API float sfShape_getOutlineThickness(const sfShape* shape);
|
||||
/// \return Number of points of the shape
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API unsigned int sfShape_getPointCount(const sfShape* shape);
|
||||
CSFML_GRAPHICS_API size_t sfShape_getPointCount(const sfShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get a point of a shape
|
||||
@@ -363,7 +366,21 @@ CSFML_GRAPHICS_API unsigned int sfShape_getPointCount(const sfShape* shape);
|
||||
/// \return Index-th point of the shape
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2f sfShape_getPoint(const sfShape* shape, unsigned int index);
|
||||
CSFML_GRAPHICS_API sfVector2f sfShape_getPoint(const sfShape* shape, size_t index);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the geometric center of the shape
|
||||
///
|
||||
/// The returned point is in local coordinates, that is,
|
||||
/// the shape's transforms (position, rotation, scale) are
|
||||
/// not taken into account.
|
||||
///
|
||||
/// \param shape Shape object
|
||||
///
|
||||
/// \return The geometric center of the shape
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2f sfShape_getGeometricCenter(const sfShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the local bounding rectangle of a shape
|
||||
@@ -401,11 +418,8 @@ CSFML_GRAPHICS_API sfFloatRect sfShape_getGlobalBounds(const sfShape* shape);
|
||||
/// \brief Recompute the internal geometry of a shape
|
||||
///
|
||||
/// This function must be called by specialized shape objects
|
||||
/// everytime their points change (ie. the result of either
|
||||
/// every time their points change (ie. the result of either
|
||||
/// the getPointCount or getPoint callbacks is different).
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfShape_update(sfShape* shape);
|
||||
|
||||
|
||||
#endif // SFML_SHAPE_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,27 +22,30 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SPRITE_H
|
||||
#define SFML_SPRITE_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Graphics/Export.h>
|
||||
#include <SFML/Graphics/BlendMode.h>
|
||||
#include <SFML/Graphics/Color.h>
|
||||
#include <SFML/Graphics/Rect.h>
|
||||
#include <SFML/Graphics/Types.h>
|
||||
#include <SFML/System/Vector2.h>
|
||||
#include <CSFML/Graphics/Export.h>
|
||||
|
||||
#include <CSFML/Graphics/BlendMode.h>
|
||||
#include <CSFML/Graphics/Color.h>
|
||||
#include <CSFML/Graphics/Rect.h>
|
||||
#include <CSFML/Graphics/Transform.h>
|
||||
#include <CSFML/Graphics/Types.h>
|
||||
#include <CSFML/System/Vector2.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new sprite
|
||||
///
|
||||
/// \param texture Source texture
|
||||
///
|
||||
/// \return A new sfSprite object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfSprite* sfSprite_create(void);
|
||||
CSFML_GRAPHICS_API sfSprite* sfSprite_create(const sfTexture* texture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Copy an existing sprite
|
||||
@@ -52,7 +55,7 @@ CSFML_GRAPHICS_API sfSprite* sfSprite_create(void);
|
||||
/// \return Copied object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfSprite* sfSprite_copy(sfSprite* sprite);
|
||||
CSFML_GRAPHICS_API sfSprite* sfSprite_copy(const sfSprite* sprite);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destroy an existing sprite
|
||||
@@ -60,7 +63,7 @@ CSFML_GRAPHICS_API sfSprite* sfSprite_copy(sfSprite* sprite);
|
||||
/// \param sprite Sprite to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfSprite_destroy(sfSprite* sprite);
|
||||
CSFML_GRAPHICS_API void sfSprite_destroy(const sfSprite* sprite);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the position of a sprite
|
||||
@@ -203,7 +206,7 @@ CSFML_GRAPHICS_API void sfSprite_scale(sfSprite* sprite, sfVector2f factors);
|
||||
/// \return Transform combining the position/rotation/scale/origin of the object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API const sfTransform* sfSprite_getTransform(const sfSprite* sprite);
|
||||
CSFML_GRAPHICS_API sfTransform sfSprite_getTransform(const sfSprite* sprite);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the inverse of the combined transform of a sprite
|
||||
@@ -213,7 +216,7 @@ CSFML_GRAPHICS_API const sfTransform* sfSprite_getTransform(const sfSprite* spri
|
||||
/// \return Inverse of the combined transformations applied to the object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API const sfTransform* sfSprite_getInverseTransform(const sfSprite* sprite);
|
||||
CSFML_GRAPHICS_API sfTransform sfSprite_getInverseTransform(const sfSprite* sprite);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change the source texture of a sprite
|
||||
@@ -233,7 +236,7 @@ CSFML_GRAPHICS_API const sfTransform* sfSprite_getInverseTransform(const sfSprit
|
||||
/// \param resetRect Should the texture rect be reset to the size of the new texture?
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfSprite_setTexture(sfSprite* sprite, const sfTexture* texture, sfBool resetRect);
|
||||
CSFML_GRAPHICS_API void sfSprite_setTexture(sfSprite* sprite, const sfTexture* texture, bool resetRect);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the sub-rectangle of the texture that a sprite will display
|
||||
@@ -327,6 +330,3 @@ CSFML_GRAPHICS_API sfFloatRect sfSprite_getLocalBounds(const sfSprite* sprite);
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfFloatRect sfSprite_getGlobalBounds(const sfSprite* sprite);
|
||||
|
||||
|
||||
#endif // SFML_SPRITE_H
|
||||
@@ -0,0 +1,96 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <CSFML/Graphics/Export.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
/// \brief Enumeration of the stencil test comparisons that can be performed
|
||||
///
|
||||
/// The comparisons are mapped directly to their OpenGL equivalents,
|
||||
/// specified by `glStencilFunc()`.
|
||||
////////////////////////////////////////////////////////
|
||||
typedef enum
|
||||
{
|
||||
sfStencilComparisonNever, //!< The stencil test never passes
|
||||
sfStencilComparisonLess, //!< The stencil test passes if the new value is less than the value in the stencil buffer
|
||||
sfStencilComparisonLessEqual, //!< The stencil test passes if the new value is less than or equal to the value in the stencil buffer
|
||||
sfStencilComparisonGreater, //!< The stencil test passes if the new value is greater than the value in the stencil buffer
|
||||
sfStencilComparisonGreaterEqual, //!< The stencil test passes if the new value is greater than or equal to the value in the stencil buffer
|
||||
sfStencilComparisonEqual, //!< The stencil test passes if the new value is strictly equal to the value in the stencil buffer
|
||||
sfStencilComparisonNotEqual, //!< The stencil test passes if the new value is strictly unequal to the value in the stencil buffer
|
||||
sfStencilComparisonAlways //!< The stencil test always passes
|
||||
} sfStencilComparison;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
/// \brief Enumeration of the stencil buffer update operations
|
||||
///
|
||||
/// The update operations are mapped directly to their OpenGL equivalents,
|
||||
/// specified by `glStencilOp()`.
|
||||
////////////////////////////////////////////////////////
|
||||
typedef enum
|
||||
{
|
||||
sfStencilUpdateOperationKeep, //!< If the stencil test passes, the value in the stencil buffer is not modified
|
||||
sfStencilUpdateOperationZero, //!< If the stencil test passes, the value in the stencil buffer is set to zero
|
||||
sfStencilUpdateOperationReplace, //!< If the stencil test passes, the value in the stencil buffer is set to the new value
|
||||
sfStencilUpdateOperationIncrement, //!< If the stencil test passes, the value in the stencil buffer is incremented and if required clamped
|
||||
sfStencilUpdateOperationDecrement, //!< If the stencil test passes, the value in the stencil buffer is decremented and if required clamped
|
||||
sfStencilUpdateOperationInvert, //!< If the stencil test passes, the value in the stencil buffer is bitwise inverted
|
||||
} sfStencilUpdateOperation;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
/// \brief Stencil value type (also used as a mask)
|
||||
///
|
||||
////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
unsigned int value; //!< The stored stencil value
|
||||
} sfStencilValue;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Stencil modes for drawing
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
sfStencilComparison stencilComparison; //!< The comparison we're performing the stencil test with
|
||||
sfStencilUpdateOperation stencilUpdateOperation; //!< The update operation to perform if the stencil test passes
|
||||
sfStencilValue stencilReference; //!< The reference value we're performing the stencil test with
|
||||
sfStencilValue stencilMask; //!< The mask to apply to both the reference value and the value in the stencil buffer
|
||||
bool stencilOnly; //!< Whether we should update the color buffer in addition to the stencil buffer
|
||||
} sfStencilMode;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Define the default values for a StencilMode
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API const sfStencilMode sfStencilMode_default;
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,17 +22,19 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_TEXT_H
|
||||
#define SFML_TEXT_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Graphics/Export.h>
|
||||
#include <SFML/Graphics/Color.h>
|
||||
#include <SFML/Graphics/Rect.h>
|
||||
#include <SFML/Graphics/Types.h>
|
||||
#include <SFML/System/Vector2.h>
|
||||
#include <CSFML/Graphics/Export.h>
|
||||
|
||||
#include <CSFML/Graphics/Color.h>
|
||||
#include <CSFML/Graphics/Rect.h>
|
||||
#include <CSFML/Graphics/Transform.h>
|
||||
#include <CSFML/Graphics/Types.h>
|
||||
#include <CSFML/System/Vector2.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
@@ -41,20 +43,23 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef enum
|
||||
{
|
||||
sfTextRegular = 0, ///< Regular characters, no style
|
||||
sfTextBold = 1 << 0, ///< Characters are bold
|
||||
sfTextItalic = 1 << 1, ///< Characters are in italic
|
||||
sfTextUnderlined = 1 << 2 ///< Characters are underlined
|
||||
sfTextRegular = 0, ///< Regular characters, no style
|
||||
sfTextBold = 1 << 0, ///< Bold characters
|
||||
sfTextItalic = 1 << 1, ///< Italic characters
|
||||
sfTextUnderlined = 1 << 2, ///< Underlined characters
|
||||
sfTextStrikeThrough = 1 << 3 ///< Strike through characters
|
||||
} sfTextStyle;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new text
|
||||
///
|
||||
/// \param font Font used to draw the string
|
||||
///
|
||||
/// \return A new sfText object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfText* sfText_create(void);
|
||||
CSFML_GRAPHICS_API sfText* sfText_create(const sfFont* font);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Copy an existing text
|
||||
@@ -64,7 +69,7 @@ CSFML_GRAPHICS_API sfText* sfText_create(void);
|
||||
/// \return Copied object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfText* sfText_copy(sfText* text);
|
||||
CSFML_GRAPHICS_API sfText* sfText_copy(const sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destroy an existing text
|
||||
@@ -72,7 +77,7 @@ CSFML_GRAPHICS_API sfText* sfText_copy(sfText* text);
|
||||
/// \param text Text to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfText_destroy(sfText* text);
|
||||
CSFML_GRAPHICS_API void sfText_destroy(const sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the position of a text
|
||||
@@ -215,7 +220,7 @@ CSFML_GRAPHICS_API void sfText_scale(sfText* text, sfVector2f factors);
|
||||
/// \return Transform combining the position/rotation/scale/origin of the object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API const sfTransform* sfText_getTransform(const sfText* text);
|
||||
CSFML_GRAPHICS_API sfTransform sfText_getTransform(const sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the inverse of the combined transform of a text
|
||||
@@ -225,7 +230,7 @@ CSFML_GRAPHICS_API const sfTransform* sfText_getTransform(const sfText* text);
|
||||
/// \return Inverse of the combined transformations applied to the object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API const sfTransform* sfText_getInverseTransform(const sfText* text);
|
||||
CSFML_GRAPHICS_API sfTransform sfText_getInverseTransform(const sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the string of a text (from an ANSI string)
|
||||
@@ -245,7 +250,7 @@ CSFML_GRAPHICS_API void sfText_setString(sfText* text, const char* string);
|
||||
/// \param string New string
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfText_setUnicodeString(sfText* text, const sfUint32* string);
|
||||
CSFML_GRAPHICS_API void sfText_setUnicodeString(sfText* text, const sfChar32* string);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the font of a text
|
||||
@@ -256,8 +261,6 @@ CSFML_GRAPHICS_API void sfText_setUnicodeString(sfText* text, const sfUint32* st
|
||||
/// a pointer to the one that you passed to this function.
|
||||
/// If the font is destroyed and the text tries to
|
||||
/// use it, the behaviour is undefined.
|
||||
/// Texts have a valid font by default, which the built-in
|
||||
/// sfFont_getDefaultFont().
|
||||
///
|
||||
/// \param text Text object
|
||||
/// \param font New font
|
||||
@@ -276,6 +279,41 @@ CSFML_GRAPHICS_API void sfText_setFont(sfText* text, const sfFont* font);
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfText_setCharacterSize(sfText* text, unsigned int size);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the line spacing factor
|
||||
///
|
||||
/// The default spacing between lines is defined by the font.
|
||||
/// This method enables you to set a factor for the spacing
|
||||
/// between lines. By default the line spacing factor is 1.
|
||||
///
|
||||
/// \param text Text object
|
||||
/// \param spacingFactor New line spacing factor
|
||||
///
|
||||
/// \see sfText_getLineSpacing
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfText_setLineSpacing(sfText* text, float spacingFactor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the letter spacing factor
|
||||
///
|
||||
/// The default spacing between letters is defined by the font.
|
||||
/// This factor doesn't directly apply to the existing
|
||||
/// spacing between each character, it rather adds a fixed
|
||||
/// space between them which is calculated from the font
|
||||
/// metrics and the character size.
|
||||
/// Note that factors below 1 (including negative numbers) bring
|
||||
/// characters closer to each other.
|
||||
/// By default the letter spacing factor is 1.
|
||||
///
|
||||
/// \param text Text object
|
||||
/// \param spacingFactor New letter spacing factor
|
||||
///
|
||||
/// \see sfText_getLetterSpacing
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfText_setLetterSpacing(sfText* text, float spacingFactor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the style of a text
|
||||
///
|
||||
@@ -287,25 +325,54 @@ CSFML_GRAPHICS_API void sfText_setCharacterSize(sfText* text, unsigned int size)
|
||||
/// \param style New style
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfText_setStyle(sfText* text, sfUint32 style);
|
||||
CSFML_GRAPHICS_API void sfText_setStyle(sfText* text, uint32_t style);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the global color of a text
|
||||
/// \brief Set the fill color of a text
|
||||
///
|
||||
/// By default, the text's color is opaque white.
|
||||
/// By default, the text's fill color is opaque white.
|
||||
/// Setting the fill color to a transparent color with an outline
|
||||
/// will cause the outline to be displayed in the fill area of the text.
|
||||
///
|
||||
/// \param text Text object
|
||||
/// \param color New color of the text
|
||||
/// \param color New fill color of the text
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfText_setColor(sfText* text, sfColor color);
|
||||
CSFML_GRAPHICS_API void sfText_setFillColor(sfText* text, sfColor color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the text of a text (returns an ANSI string)
|
||||
/// \brief Set the outline color of the text
|
||||
///
|
||||
/// By default, the text's outline color is opaque black.
|
||||
///
|
||||
/// \param text Text object
|
||||
/// \param color New outline color of the text
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfText_setOutlineColor(sfText* text, sfColor color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the thickness of the text's outline
|
||||
///
|
||||
/// By default, the outline thickness is 0.
|
||||
///
|
||||
/// Be aware that using a negative value for the outline
|
||||
/// thickness will cause distorted rendering.
|
||||
///
|
||||
/// \param text Text object
|
||||
/// \param thickness New outline thickness, in pixels
|
||||
///
|
||||
/// \see getOutlineThickness
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfText_setOutlineThickness(sfText* text, float thickness);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the string of a text (returns an ANSI string)
|
||||
///
|
||||
/// \param text Text object
|
||||
///
|
||||
/// \return String an a locale-dependant ANSI string
|
||||
/// \return String as a locale-dependant ANSI string
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API const char* sfText_getString(const sfText* text);
|
||||
@@ -318,11 +385,15 @@ CSFML_GRAPHICS_API const char* sfText_getString(const sfText* text);
|
||||
/// \return String as UTF-32
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API const sfUint32* sfText_getUnicodeString(const sfText* text);
|
||||
CSFML_GRAPHICS_API const sfChar32* sfText_getUnicodeString(const sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the font used by a text
|
||||
///
|
||||
/// If the text has no font attached, a NULL pointer is returned.
|
||||
/// The returned pointer is const, which means that you can't
|
||||
/// modify the font when you retrieve it with this function.
|
||||
///
|
||||
/// \param text Text object
|
||||
///
|
||||
/// \return Pointer to the font
|
||||
@@ -340,6 +411,30 @@ CSFML_GRAPHICS_API const sfFont* sfText_getFont(const sfText* text);
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API unsigned int sfText_getCharacterSize(const sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the size of the letter spacing factor
|
||||
///
|
||||
/// \param text Text object
|
||||
///
|
||||
/// \return Size of the letter spacing factor
|
||||
///
|
||||
/// \see sfText_setLetterSpacing
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API float sfText_getLetterSpacing(const sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the size of the line spacing factor
|
||||
///
|
||||
/// \param text Text object
|
||||
///
|
||||
/// \return Size of the line spacing factor
|
||||
///
|
||||
/// \see sfText_setLineSpacing
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API float sfText_getLineSpacing(const sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the style of a text
|
||||
///
|
||||
@@ -348,17 +443,37 @@ CSFML_GRAPHICS_API unsigned int sfText_getCharacterSize(const sfText* text);
|
||||
/// \return Current string style (see sfTextStyle enum)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfUint32 sfText_getStyle(const sfText* text);
|
||||
CSFML_GRAPHICS_API uint32_t sfText_getStyle(const sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the global color of a text
|
||||
/// \brief Get the fill color of a text
|
||||
///
|
||||
/// \param text Text object
|
||||
///
|
||||
/// \return Global color of the text
|
||||
/// \return Fill color of the text
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfColor sfText_getColor(const sfText* text);
|
||||
CSFML_GRAPHICS_API sfColor sfText_getFillColor(const sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the outline color of a text
|
||||
///
|
||||
/// \param text Text object
|
||||
///
|
||||
/// \return Outline color of the text
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfColor sfText_getOutlineColor(const sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the outline thickness of a text
|
||||
///
|
||||
/// \param text Text object
|
||||
///
|
||||
/// \return Outline thickness of a text, in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API float sfText_getOutlineThickness(const sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return the position of the \a index-th character in a text
|
||||
@@ -409,6 +524,3 @@ CSFML_GRAPHICS_API sfFloatRect sfText_getLocalBounds(const sfText* text);
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfFloatRect sfText_getGlobalBounds(const sfText* text);
|
||||
|
||||
|
||||
#endif // SFML_TEXT_H
|
||||
@@ -0,0 +1,402 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <CSFML/Graphics/Export.h>
|
||||
|
||||
#include <CSFML/Graphics/CoordinateType.h>
|
||||
#include <CSFML/Graphics/Rect.h>
|
||||
#include <CSFML/Graphics/Types.h>
|
||||
#include <CSFML/System/InputStream.h>
|
||||
#include <CSFML/System/Vector2.h>
|
||||
#include <CSFML/Window/Types.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new texture
|
||||
///
|
||||
/// \param size Texture size
|
||||
///
|
||||
/// \return A new sfTexture object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfTexture* sfTexture_create(sfVector2u size);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new sRGB-enabled texture
|
||||
///
|
||||
/// \param size Texture size
|
||||
///
|
||||
/// \return A new sfTexture object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfTexture* sfTexture_createSrgb(sfVector2u size);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new texture from a file
|
||||
///
|
||||
/// \param filename Path of the image file to load
|
||||
/// \param area Area of the source image to load (NULL to load the entire image)
|
||||
///
|
||||
/// \return A new sfTexture object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfTexture* sfTexture_createFromFile(const char* filename, const sfIntRect* area);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new sRGB-enabled texture from a file
|
||||
///
|
||||
/// When providing texture data from an image file or memory, it can
|
||||
/// either be stored in a linear color space or an sRGB color space.
|
||||
/// Most digital images account for gamma correction already, so they
|
||||
/// would need to be "uncorrected" back to linear color space before
|
||||
/// being processed by the hardware. The hardware can automatically
|
||||
/// convert it from the sRGB color space to a linear color space when
|
||||
/// it gets sampled. When the rendered image gets output to the final
|
||||
/// framebuffer, it gets converted back to sRGB.
|
||||
///
|
||||
/// This load option is only useful in conjunction with an sRGB capable
|
||||
/// framebuffer. This can be requested during window creation.
|
||||
///
|
||||
/// \param filename Path of the image file to load
|
||||
/// \param area Area of the source image to load (NULL to load the entire image)
|
||||
///
|
||||
/// \return A new sfTexture object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfTexture* sfTexture_createSrgbFromFile(const char* filename, const sfIntRect* area);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new texture from a file in memory
|
||||
///
|
||||
/// \param data Pointer to the file data in memory
|
||||
/// \param sizeInBytes Size of the data to load, in bytes
|
||||
/// \param area Area of the source image to load (NULL to load the entire image)
|
||||
///
|
||||
/// \return A new sfTexture object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfTexture* sfTexture_createFromMemory(const void* data, size_t sizeInBytes, const sfIntRect* area);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new sRGB-enabled texture from a file in memory
|
||||
///
|
||||
/// \param data Pointer to the file data in memory
|
||||
/// \param sizeInBytes Size of the data to load, in bytes
|
||||
/// \param area Area of the source image to load (NULL to load the entire image)
|
||||
///
|
||||
/// \return A new sfTexture object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfTexture* sfTexture_createSrgbFromMemory(const void* data, size_t sizeInBytes, const sfIntRect* area);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new texture from a custom stream
|
||||
///
|
||||
/// \param stream Source stream to read from
|
||||
/// \param area Area of the source image to load (NULL to load the entire image)
|
||||
///
|
||||
/// \return A new sfTexture object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfTexture* sfTexture_createFromStream(sfInputStream* stream, const sfIntRect* area);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new sRGB-enabled texture from a custom stream
|
||||
///
|
||||
/// \param stream Source stream to read from
|
||||
/// \param area Area of the source image to load (NULL to load the entire image)
|
||||
///
|
||||
/// \return A new sfTexture object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfTexture* sfTexture_createSrgbFromStream(sfInputStream* stream, const sfIntRect* area);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new texture from an image
|
||||
///
|
||||
/// \param image Image to upload to the texture
|
||||
/// \param area Area of the source image to load (NULL to load the entire image)
|
||||
///
|
||||
/// \return A new sfTexture object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfTexture* sfTexture_createFromImage(const sfImage* image, const sfIntRect* area);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new sRGB-enabled texture from an image
|
||||
///
|
||||
/// \param image Image to upload to the texture
|
||||
/// \param area Area of the source image to load (NULL to load the entire image)
|
||||
///
|
||||
/// \return A new sfTexture object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfTexture* sfTexture_createSrgbFromImage(const sfImage* image, const sfIntRect* area);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Copy an existing texture
|
||||
///
|
||||
/// \param texture Texture to copy
|
||||
///
|
||||
/// \return Copied object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfTexture* sfTexture_copy(const sfTexture* texture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destroy an existing texture
|
||||
///
|
||||
/// \param texture Texture to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfTexture_destroy(const sfTexture* texture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return the size of the texture
|
||||
///
|
||||
/// \param texture Texture to read
|
||||
///
|
||||
/// \return Size in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2u sfTexture_getSize(const sfTexture* texture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Copy a texture's pixels to an image
|
||||
///
|
||||
/// \param texture Texture to copy
|
||||
///
|
||||
/// \return Image containing the texture's pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfImage* sfTexture_copyToImage(const sfTexture* texture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Update a texture from an array of pixels
|
||||
///
|
||||
/// \param texture Texture to update
|
||||
/// \param pixels Array of pixels to copy to the texture
|
||||
/// \param size size of the pixel region contained in \a pixels
|
||||
/// \param offset Offset in the texture where to copy the source pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfTexture_updateFromPixels(sfTexture* texture, const uint8_t* pixels, sfVector2u size, sfVector2u offset);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Update a part of this texture from another texture
|
||||
///
|
||||
/// No additional check is performed on the size of the texture,
|
||||
/// passing an invalid combination of texture size and offset
|
||||
/// will lead to an undefined behavior.
|
||||
///
|
||||
/// This function does nothing if either texture was not
|
||||
/// previously created.
|
||||
///
|
||||
/// \param destination Destination texture to copy source texture to
|
||||
/// \param source Source texture to copy to destination texture
|
||||
/// \param offset Offset in this texture where to copy the source texture
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfTexture_updateFromTexture(sfTexture* destination, const sfTexture* source, sfVector2u offset);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Update a texture from an image
|
||||
///
|
||||
/// \param texture Texture to update
|
||||
/// \param image Image to copy to the texture
|
||||
/// \param offset Offset in the texture where to copy the source pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfTexture_updateFromImage(sfTexture* texture, const sfImage* image, sfVector2u offset);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Update a texture from the contents of a window
|
||||
///
|
||||
/// \param texture Texture to update
|
||||
/// \param window Window to copy to the texture
|
||||
/// \param offset Offset in the texture where to copy the source pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfTexture_updateFromWindow(sfTexture* texture, const sfWindow* window, sfVector2u offset);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Update a texture from the contents of a render-window
|
||||
///
|
||||
/// \param texture Texture to update
|
||||
/// \param renderWindow Render-window to copy to the texture
|
||||
/// \param offset Offset in the texture where to copy the source pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfTexture_updateFromRenderWindow(sfTexture* texture, const sfRenderWindow* renderWindow, sfVector2u offset);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Enable or disable the smooth filter on a texture
|
||||
///
|
||||
/// \param texture The texture object
|
||||
/// \param smooth true to enable smoothing, false to disable it
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfTexture_setSmooth(sfTexture* texture, bool smooth);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether the smooth filter is enabled or not for a texture
|
||||
///
|
||||
/// \param texture The texture object
|
||||
///
|
||||
/// \return true if smoothing is enabled, false if it is disabled
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API bool sfTexture_isSmooth(const sfTexture* texture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether the texture source is converted from sRGB or not
|
||||
///
|
||||
/// \return True if the texture source is converted from sRGB, false if not
|
||||
///
|
||||
/// \see sfTexture_createSrgbFromFile
|
||||
/// \see sfTexture_createSrgbFromMemory
|
||||
/// \see sfTexture_createSrgbFromStream
|
||||
/// \see sfTexture_createSrgbFromImage
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API bool sfTexture_isSrgb(const sfTexture* texture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Enable or disable repeating for a texture
|
||||
///
|
||||
/// Repeating is involved when using texture coordinates
|
||||
/// outside the texture rectangle [0, 0, width, height].
|
||||
/// In this case, if repeat mode is enabled, the whole texture
|
||||
/// will be repeated as many times as needed to reach the
|
||||
/// coordinate (for example, if the X texture coordinate is
|
||||
/// 3 * width, the texture will be repeated 3 times).
|
||||
/// If repeat mode is disabled, the "extra space" will instead
|
||||
/// be filled with border pixels.
|
||||
/// Warning: on very old graphics cards, white pixels may appear
|
||||
/// when the texture is repeated. With such cards, repeat mode
|
||||
/// can be used reliably only if the texture has power-of-two
|
||||
/// dimensions (such as 256x128).
|
||||
/// Repeating is disabled by default.
|
||||
///
|
||||
/// \param texture The texture object
|
||||
/// \param repeated True to repeat the texture, false to disable repeating
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfTexture_setRepeated(sfTexture* texture, bool repeated);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether a texture is repeated or not
|
||||
///
|
||||
/// \param texture The texture object
|
||||
///
|
||||
/// \return true if repeat mode is enabled, false if it is disabled
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API bool sfTexture_isRepeated(const sfTexture* texture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Generate a mipmap using the current texture data
|
||||
///
|
||||
/// Mipmaps are pre-computed chains of optimized textures. Each
|
||||
/// level of texture in a mipmap is generated by halving each of
|
||||
/// the previous level's dimensions. This is done until the final
|
||||
/// level has the size of 1x1. The textures generated in this process may
|
||||
/// make use of more advanced filters which might improve the visual quality
|
||||
/// of textures when they are applied to objects much smaller than they are.
|
||||
/// This is known as minification. Because fewer texels (texture elements)
|
||||
/// have to be sampled from when heavily minified, usage of mipmaps
|
||||
/// can also improve rendering performance in certain scenarios.
|
||||
///
|
||||
/// Mipmap generation relies on the necessary OpenGL extension being
|
||||
/// available. If it is unavailable or generation fails due to another
|
||||
/// reason, this function will return false. Mipmap data is only valid from
|
||||
/// the time it is generated until the next time the base level image is
|
||||
/// modified, at which point this function will have to be called again to
|
||||
/// regenerate it.
|
||||
///
|
||||
/// \return true if mipmap generation was successful, false if unsuccessful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API bool sfTexture_generateMipmap(sfTexture* texture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Swap the contents of a texture with those of another
|
||||
///
|
||||
/// \param left Instance to swap from
|
||||
/// \param right Instance to swap with
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfTexture_swap(sfTexture* left, sfTexture* right);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the underlying OpenGL handle of the texture.
|
||||
///
|
||||
/// You shouldn't need to use this function, unless you have
|
||||
/// very specific stuff to implement that SFML doesn't support,
|
||||
/// or implement a temporary workaround until a bug is fixed.
|
||||
///
|
||||
/// \param texture The texture object
|
||||
///
|
||||
/// \return OpenGL handle of the texture or 0 if not yet created
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API unsigned int sfTexture_getNativeHandle(const sfTexture* texture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Bind a texture for rendering
|
||||
///
|
||||
/// This function is not part of the graphics API, it mustn't be
|
||||
/// used when drawing SFML entities. It must be used only if you
|
||||
/// mix sfTexture with OpenGL code.
|
||||
///
|
||||
/// \code
|
||||
/// sfTexture *t1, *t2;
|
||||
/// ...
|
||||
/// sfTexture_bind(t1);
|
||||
/// // draw OpenGL stuff that use t1...
|
||||
/// sfTexture_bind(t2);
|
||||
/// // draw OpenGL stuff that use t2...
|
||||
/// sfTexture_bind(NULL);
|
||||
/// // draw OpenGL stuff that use no texture...
|
||||
/// \endcode
|
||||
///
|
||||
/// \param texture Pointer to the texture to bind, can be null to use no texture
|
||||
/// \param type Type of texture coordinates to use
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfTexture_bind(const sfTexture* texture, sfCoordinateType type);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the maximum texture size allowed
|
||||
///
|
||||
/// \return Maximum size allowed for textures, in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API unsigned int sfTexture_getMaximumSize(void);
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,27 +22,33 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_TRANSFORM_H
|
||||
#define SFML_TRANSFORM_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Graphics/Export.h>
|
||||
#include <SFML/Graphics/Rect.h>
|
||||
#include <SFML/Graphics/Types.h>
|
||||
#include <SFML/System/Vector2.h>
|
||||
#include <CSFML/Graphics/Export.h>
|
||||
|
||||
#include <CSFML/Graphics/Rect.h>
|
||||
#include <CSFML/Graphics/Types.h>
|
||||
#include <CSFML/System/Vector2.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new transform
|
||||
///
|
||||
/// This function creates an identity transform.
|
||||
///
|
||||
/// \return A new sfTransform object
|
||||
/// \brief Encapsulate a 3x3 transform matrix
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfTransform* sfTransform_create(void);
|
||||
typedef struct
|
||||
{
|
||||
float matrix[9];
|
||||
} sfTransform;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Identity transform (does nothing)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API const sfTransform sfTransform_Identity;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new transform from a matrix
|
||||
@@ -60,46 +66,28 @@ CSFML_GRAPHICS_API sfTransform* sfTransform_create(void);
|
||||
/// \return A new sfTransform object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfTransform* sfTransform_createFromMatrix(float a00, float a01, float a02,
|
||||
float a10, float a11, float a12,
|
||||
float a20, float a21, float a22);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Copy an existing transform
|
||||
///
|
||||
/// \param transform Transform to copy
|
||||
///
|
||||
/// \return Copied object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfTransform* sfTransform_copy(sfTransform* transform);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destroy an existing transform
|
||||
///
|
||||
/// \param transform Transform to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfTransform_destroy(sfTransform* transform);
|
||||
CSFML_GRAPHICS_API sfTransform
|
||||
sfTransform_fromMatrix(float a00, float a01, float a02, float a10, float a11, float a12, float a20, float a21, float a22);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return the 4x4 matrix of a transform
|
||||
///
|
||||
/// This function returns a pointer to an array of 16 floats
|
||||
/// containing the transform elements as a 4x4 matrix, which
|
||||
/// is directly compatible with OpenGL functions.
|
||||
/// This function fills an array of 16 floats with the transform
|
||||
/// converted as a 4x4 matrix, which is directly compatible with
|
||||
/// OpenGL functions.
|
||||
///
|
||||
/// \code
|
||||
/// sfTransform* transform = ...;
|
||||
/// glLoadMatrixf(sfTransform_getMatrix(transform));
|
||||
/// sfTransform transform = ...;
|
||||
/// float matrix[16];
|
||||
/// sfTransform_getMatrix(&transform, matrix)
|
||||
/// glLoadMatrixf(matrix);
|
||||
/// \endcode
|
||||
///
|
||||
/// \param transform Transform object
|
||||
///
|
||||
/// \return Pointer to a 4x4 matrix
|
||||
/// \param matrix Pointer to the 16-element array to fill with the matrix
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API const float* sfTransform_getMatrix(const sfTransform* transform);
|
||||
CSFML_GRAPHICS_API void sfTransform_getMatrix(const sfTransform* transform, float* matrix);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return the inverse of a transform
|
||||
@@ -108,10 +96,10 @@ CSFML_GRAPHICS_API const float* sfTransform_getMatrix(const sfTransform* transfo
|
||||
/// is returned.
|
||||
///
|
||||
/// \param transform Transform object
|
||||
/// \param result Returned inverse matrix
|
||||
/// \return The inverse matrix
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfTransform_getInverse(const sfTransform* transform, sfTransform* result);
|
||||
CSFML_GRAPHICS_API sfTransform sfTransform_getInverse(const sfTransform* transform);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Apply a transform to a 2D point
|
||||
@@ -149,7 +137,7 @@ CSFML_GRAPHICS_API sfFloatRect sfTransform_transformRect(const sfTransform* tran
|
||||
/// equivalent to a matrix multiplication.
|
||||
///
|
||||
/// \param transform Transform object
|
||||
/// \param right Transform to combine to \a transform
|
||||
/// \param other Transform to combine to \a transform
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfTransform_combine(sfTransform* transform, const sfTransform* other);
|
||||
@@ -158,11 +146,10 @@ CSFML_GRAPHICS_API void sfTransform_combine(sfTransform* transform, const sfTran
|
||||
/// \brief Combine a transform with a translation
|
||||
///
|
||||
/// \param transform Transform object
|
||||
/// \param x Offset to apply on X axis
|
||||
/// \param y Offset to apply on Y axis
|
||||
/// \param offset Offset to apply
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfTransform_translate(sfTransform* transform, float x, float y);
|
||||
CSFML_GRAPHICS_API void sfTransform_translate(sfTransform* transform, sfVector2f offset);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Combine the current transform with a rotation
|
||||
@@ -183,21 +170,19 @@ CSFML_GRAPHICS_API void sfTransform_rotate(sfTransform* transform, float angle);
|
||||
///
|
||||
/// \param transform Transform object
|
||||
/// \param angle Rotation angle, in degrees
|
||||
/// \param centerX X coordinate of the center of rotation
|
||||
/// \param centerY Y coordinate of the center of rotation
|
||||
/// \param center Coordinates of the center of rotation
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfTransform_rotateWithCenter(sfTransform* transform, float angle, float centerX, float centerY);
|
||||
CSFML_GRAPHICS_API void sfTransform_rotateWithCenter(sfTransform* transform, float angle, sfVector2f center);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Combine the current transform with a scaling
|
||||
///
|
||||
/// \param transform Transform object
|
||||
/// \param scaleX Scaling factor on the X axis
|
||||
/// \param scaleY Scaling factor on the Y axis
|
||||
/// \param scale Scaling factor
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfTransform_scale(sfTransform* transform, float scaleX, float scaleY);
|
||||
CSFML_GRAPHICS_API void sfTransform_scale(sfTransform* transform, sfVector2f scale);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Combine the current transform with a scaling
|
||||
@@ -208,13 +193,22 @@ CSFML_GRAPHICS_API void sfTransform_scale(sfTransform* transform, float scaleX,
|
||||
/// [translate(-center), scale(factors), translate(center)]
|
||||
///
|
||||
/// \param transform Transform object
|
||||
/// \param scaleX Scaling factor on X axis
|
||||
/// \param scaleY Scaling factor on Y axis
|
||||
/// \param centerX X coordinate of the center of scaling
|
||||
/// \param centerY Y coordinate of the center of scaling
|
||||
/// \param scale Scaling factor
|
||||
/// \param center Coordinates of the center of scaling
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfTransform_scaleWithCenter(sfTransform* transform, float scaleX, float scaleY, float centerX, float centerY);
|
||||
CSFML_GRAPHICS_API void sfTransform_scaleWithCenter(sfTransform* transform, sfVector2f scale, sfVector2f center);
|
||||
|
||||
|
||||
#endif // SFML_TRANSFORM_H
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Compare two transforms for equality
|
||||
///
|
||||
/// Performs an element-wise comparison of the elements of the
|
||||
/// left transform with the elements of the right transform.
|
||||
///
|
||||
/// \param left Left operand (the first transform)
|
||||
/// \param right Right operand (the second transform)
|
||||
///
|
||||
/// \return true if the transforms are equal, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API bool sfTransform_equal(sfTransform* left, sfTransform* right);
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,15 +22,16 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_TRANSFORMABLE_H
|
||||
#define SFML_TRANSFORMABLE_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Graphics/Export.h>
|
||||
#include <SFML/Graphics/Types.h>
|
||||
#include <SFML/System/Vector2.h>
|
||||
#include <CSFML/Graphics/Export.h>
|
||||
|
||||
#include <CSFML/Graphics/Transform.h>
|
||||
#include <CSFML/Graphics/Types.h>
|
||||
#include <CSFML/System/Vector2.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -49,7 +50,7 @@ CSFML_GRAPHICS_API sfTransformable* sfTransformable_create(void);
|
||||
/// \return Copied object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfTransformable* sfTransformable_copy(sfTransformable* transformable);
|
||||
CSFML_GRAPHICS_API sfTransformable* sfTransformable_copy(const sfTransformable* transformable);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destroy an existing transformable
|
||||
@@ -57,7 +58,7 @@ CSFML_GRAPHICS_API sfTransformable* sfTransformable_copy(sfTransformable* transf
|
||||
/// \param transformable Transformable to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfTransformable_destroy(sfTransformable* transformable);
|
||||
CSFML_GRAPHICS_API void sfTransformable_destroy(const sfTransformable* transformable);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the position of a transformable
|
||||
@@ -200,7 +201,7 @@ CSFML_GRAPHICS_API void sfTransformable_scale(sfTransformable* transformable, sf
|
||||
/// \return Transform combining the position/rotation/scale/origin of the object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API const sfTransform* sfTransformable_getTransform(const sfTransformable* transformable);
|
||||
CSFML_GRAPHICS_API sfTransform sfTransformable_getTransform(const sfTransformable* transformable);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the inverse of the combined transform of a transformable
|
||||
@@ -210,7 +211,4 @@ CSFML_GRAPHICS_API const sfTransform* sfTransformable_getTransform(const sfTrans
|
||||
/// \return Inverse of the combined transformations applied to the object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API const sfTransform* sfTransformable_getInverseTransform(const sfTransformable* transformable);
|
||||
|
||||
|
||||
#endif // SFML_TRANSFORMABLE_H
|
||||
CSFML_GRAPHICS_API sfTransform sfTransformable_getInverseTransform(const sfTransformable* transformable);
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,26 +22,22 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_GRAPHICS_TYPES_H
|
||||
#define SFML_GRAPHICS_TYPES_H
|
||||
#pragma once
|
||||
|
||||
|
||||
typedef struct sfCircleShape sfCircleShape;
|
||||
typedef struct sfConvexShape sfConvexShape;
|
||||
typedef struct sfFont sfFont;
|
||||
typedef struct sfImage sfImage;
|
||||
typedef struct sfShader sfShader;
|
||||
typedef struct sfCircleShape sfCircleShape;
|
||||
typedef struct sfConvexShape sfConvexShape;
|
||||
typedef struct sfFont sfFont;
|
||||
typedef struct sfImage sfImage;
|
||||
typedef struct sfShader sfShader;
|
||||
typedef struct sfRectangleShape sfRectangleShape;
|
||||
typedef struct sfRenderTexture sfRenderTexture;
|
||||
typedef struct sfRenderWindow sfRenderWindow;
|
||||
typedef struct sfShape sfShape;
|
||||
typedef struct sfSprite sfSprite;
|
||||
typedef struct sfText sfText;
|
||||
typedef struct sfTexture sfTexture;
|
||||
typedef struct sfTransform sfTransform;
|
||||
typedef struct sfTransformable sfTransformable;
|
||||
typedef struct sfVertexArray sfVertexArray;
|
||||
typedef struct sfView sfView;
|
||||
|
||||
|
||||
#endif // SFML_GRAPHICS_TYPES_H
|
||||
typedef struct sfRenderTexture sfRenderTexture;
|
||||
typedef struct sfRenderWindow sfRenderWindow;
|
||||
typedef struct sfShape sfShape;
|
||||
typedef struct sfSprite sfSprite;
|
||||
typedef struct sfText sfText;
|
||||
typedef struct sfTexture sfTexture;
|
||||
typedef struct sfTransformable sfTransformable;
|
||||
typedef struct sfVertexArray sfVertexArray;
|
||||
typedef struct sfVertexBuffer sfVertexBuffer;
|
||||
typedef struct sfView sfView;
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,15 +22,15 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_VERTEX_H
|
||||
#define SFML_VERTEX_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Graphics/Export.h>
|
||||
#include <SFML/Graphics/Color.h>
|
||||
#include <SFML/System/Vector2.h>
|
||||
#include <CSFML/Graphics/Export.h>
|
||||
|
||||
#include <CSFML/Graphics/Color.h>
|
||||
#include <CSFML/System/Vector2.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -42,6 +42,3 @@ typedef struct
|
||||
sfColor color; ///< Color of the vertex
|
||||
sfVector2f texCoords; ///< Coordinates of the texture's pixel to map to the vertex
|
||||
} sfVertex;
|
||||
|
||||
|
||||
#endif // SFML_VERTEX_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,17 +22,19 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_VERTEXARRAY_H
|
||||
#define SFML_VERTEXARRAY_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Graphics/Export.h>
|
||||
#include <SFML/Graphics/PrimitiveType.h>
|
||||
#include <SFML/Graphics/Rect.h>
|
||||
#include <SFML/Graphics/Types.h>
|
||||
#include <SFML/Graphics/Vertex.h>
|
||||
#include <CSFML/Graphics/Export.h>
|
||||
|
||||
#include <CSFML/Graphics/PrimitiveType.h>
|
||||
#include <CSFML/Graphics/Rect.h>
|
||||
#include <CSFML/Graphics/Types.h>
|
||||
#include <CSFML/Graphics/Vertex.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -51,7 +53,7 @@ CSFML_GRAPHICS_API sfVertexArray* sfVertexArray_create(void);
|
||||
/// \return Copied object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVertexArray* sfVertexArray_copy(sfVertexArray* vertexArray);
|
||||
CSFML_GRAPHICS_API sfVertexArray* sfVertexArray_copy(const sfVertexArray* vertexArray);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destroy an existing vertex array
|
||||
@@ -59,7 +61,7 @@ CSFML_GRAPHICS_API sfVertexArray* sfVertexArray_copy(sfVertexArray* vertexArray)
|
||||
/// \param vertexArray Vertex array to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfVertexArray_destroy(sfVertexArray* vertexArray);
|
||||
CSFML_GRAPHICS_API void sfVertexArray_destroy(const sfVertexArray* vertexArray);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return the vertex count of a vertex array
|
||||
@@ -69,7 +71,7 @@ CSFML_GRAPHICS_API void sfVertexArray_destroy(sfVertexArray* vertexArray);
|
||||
/// \return Number of vertices in the array
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API unsigned int sfVertexArray_getVertexCount(const sfVertexArray* vertexArray);
|
||||
CSFML_GRAPHICS_API size_t sfVertexArray_getVertexCount(const sfVertexArray* vertexArray);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get access to a vertex by its index
|
||||
@@ -84,7 +86,7 @@ CSFML_GRAPHICS_API unsigned int sfVertexArray_getVertexCount(const sfVertexArray
|
||||
/// \return Pointer to the index-th vertex
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVertex* sfVertexArray_getVertex(sfVertexArray* vertexArray, unsigned int index);
|
||||
CSFML_GRAPHICS_API sfVertex* sfVertexArray_getVertex(sfVertexArray* vertexArray, size_t index);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Clear a vertex array
|
||||
@@ -108,16 +110,16 @@ CSFML_GRAPHICS_API void sfVertexArray_clear(sfVertexArray* vertexArray);
|
||||
/// If \a vertexCount is less than the current size, existing vertices
|
||||
/// are removed from the array.
|
||||
///
|
||||
/// \param vertexArray Vertex array objet
|
||||
/// \param vertexArray Vertex array object
|
||||
/// \param vertexCount New size of the array (number of vertices)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfVertexArray_resize(sfVertexArray* vertexArray, unsigned int vertexCount);
|
||||
CSFML_GRAPHICS_API void sfVertexArray_resize(sfVertexArray* vertexArray, size_t vertexCount);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Add a vertex to a vertex array array
|
||||
///
|
||||
/// \param vertexArray Vertex array objet
|
||||
/// \param vertexArray Vertex array object
|
||||
/// \param vertex Vertex to add
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -134,7 +136,7 @@ CSFML_GRAPHICS_API void sfVertexArray_append(sfVertexArray* vertexArray, sfVerte
|
||||
/// \li As quads
|
||||
/// The default primitive type is sfPoints.
|
||||
///
|
||||
/// \param vertexArray Vertex array objet
|
||||
/// \param vertexArray Vertex array object
|
||||
/// \param type Type of primitive
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -143,7 +145,7 @@ CSFML_GRAPHICS_API void sfVertexArray_setPrimitiveType(sfVertexArray* vertexArra
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the type of primitives drawn by a vertex array
|
||||
///
|
||||
/// \param vertexArray Vertex array objet
|
||||
/// \param vertexArray Vertex array object
|
||||
///
|
||||
/// \return Primitive type
|
||||
///
|
||||
@@ -156,12 +158,9 @@ CSFML_GRAPHICS_API sfPrimitiveType sfVertexArray_getPrimitiveType(sfVertexArray*
|
||||
/// This function returns the axis-aligned rectangle that
|
||||
/// contains all the vertices of the array.
|
||||
///
|
||||
/// \param vertexArray Vertex array objet
|
||||
/// \param vertexArray Vertex array object
|
||||
///
|
||||
/// \return Bounding rectangle of the vertex array
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfFloatRect sfVertexArray_getBounds(sfVertexArray* vertexArray);
|
||||
|
||||
|
||||
#endif // SFML_VERTEXARRAY_H
|
||||
@@ -0,0 +1,256 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <CSFML/Graphics/Export.h>
|
||||
|
||||
#include <CSFML/Graphics/PrimitiveType.h>
|
||||
#include <CSFML/Graphics/Types.h>
|
||||
#include <CSFML/Graphics/Vertex.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Usage specifiers
|
||||
///
|
||||
/// If data is going to be updated once or more every frame,
|
||||
/// set the usage to sfVertexBufferStream. If data is going
|
||||
/// to be set once and used for a long time without being
|
||||
/// modified, set the usage to sfVertexBufferUsageStatic.
|
||||
/// For everything else sfVertexBufferUsageDynamic should
|
||||
/// be a good compromise.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef enum
|
||||
{
|
||||
sfVertexBufferStream, ///< Constantly changing data
|
||||
sfVertexBufferDynamic, ///< Occasionally changing data
|
||||
sfVertexBufferStatic ///< Rarely changing data
|
||||
} sfVertexBufferUsage;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new vertex buffer with a specific
|
||||
/// sfPrimitiveType and usage specifier.
|
||||
///
|
||||
/// Creates the vertex buffer, allocating enough graphics
|
||||
/// memory to hold \p vertexCount vertices, and sets its
|
||||
/// primitive type to \p type and usage to \p usage.
|
||||
///
|
||||
/// \param vertexCount Amount of vertices
|
||||
/// \param type Type of primitive
|
||||
/// \param usage Usage specifier
|
||||
///
|
||||
/// \return A new sfVertexBuffer object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVertexBuffer* sfVertexBuffer_create(size_t vertexCount, sfPrimitiveType type, sfVertexBufferUsage usage);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Copy an existing vertex buffer
|
||||
///
|
||||
/// \param vertexBuffer Vertex buffer to copy
|
||||
///
|
||||
/// \return Copied object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVertexBuffer* sfVertexBuffer_copy(const sfVertexBuffer* vertexBuffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destroy an existing vertex buffer
|
||||
///
|
||||
/// \param vertexBuffer Vertex buffer to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfVertexBuffer_destroy(const sfVertexBuffer* vertexBuffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return the vertex count
|
||||
///
|
||||
/// \param vertexBuffer Vertex buffer object
|
||||
///
|
||||
/// \return Number of vertices in the vertex buffer
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API size_t sfVertexBuffer_getVertexCount(const sfVertexBuffer* vertexBuffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Update a part of the buffer from an array of vertices
|
||||
///
|
||||
/// \p offset is specified as the number of vertices to skip
|
||||
/// from the beginning of the buffer.
|
||||
///
|
||||
/// If \p offset is 0 and \p vertexCount is equal to the size of
|
||||
/// the currently created buffer, its whole contents are replaced.
|
||||
///
|
||||
/// If \p offset is 0 and \p vertexCount is greater than the
|
||||
/// size of the currently created buffer, a new buffer is created
|
||||
/// containing the vertex data.
|
||||
///
|
||||
/// If \p offset is 0 and \p vertexCount is less than the size of
|
||||
/// the currently created buffer, only the corresponding region
|
||||
/// is updated.
|
||||
///
|
||||
/// If \p offset is not 0 and \p offset + \p vertexCount is greater
|
||||
/// than the size of the currently created buffer, the update fails.
|
||||
///
|
||||
/// No additional check is performed on the size of the vertex
|
||||
/// array, passing invalid arguments will lead to undefined
|
||||
/// behavior.
|
||||
///
|
||||
/// \param vertexBuffer Vertex buffer object
|
||||
/// \param vertices Array of vertices to copy to the buffer
|
||||
/// \param vertexCount Number of vertices to copy
|
||||
/// \param offset Offset in the buffer to copy to
|
||||
///
|
||||
/// \return true if the update was successful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API bool sfVertexBuffer_update(sfVertexBuffer* vertexBuffer,
|
||||
const sfVertex* vertices,
|
||||
unsigned int vertexCount,
|
||||
unsigned int offset);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Copy the contents of another buffer into this buffer
|
||||
///
|
||||
/// \param vertexBuffer Vertex buffer object
|
||||
/// \param other Vertex buffer whose contents to copy into first vertex buffer
|
||||
///
|
||||
/// \return true if the copy was successful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API bool sfVertexBuffer_updateFromVertexBuffer(sfVertexBuffer* vertexBuffer, const sfVertexBuffer* other);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Swap the contents of this vertex buffer with those of another
|
||||
///
|
||||
/// \param left Instance to swap
|
||||
/// \param right Instance to swap with
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfVertexBuffer_swap(sfVertexBuffer* left, sfVertexBuffer* right);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the underlying OpenGL handle of the vertex buffer.
|
||||
///
|
||||
/// You shouldn't need to use this function, unless you have
|
||||
/// very specific stuff to implement that SFML doesn't support,
|
||||
/// or implement a temporary workaround until a bug is fixed.
|
||||
///
|
||||
/// \return OpenGL handle of the vertex buffer or 0 if not yet created
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API unsigned int sfVertexBuffer_getNativeHandle(sfVertexBuffer* vertexBuffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the type of primitives to draw
|
||||
///
|
||||
/// This function defines how the vertices must be interpreted
|
||||
/// when it's time to draw them.
|
||||
///
|
||||
/// The default primitive type is sfPoints.
|
||||
///
|
||||
/// \param vertexBuffer Vertex buffer object
|
||||
/// \param type Type of primitive
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfVertexBuffer_setPrimitiveType(sfVertexBuffer* vertexBuffer, sfPrimitiveType type);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the type of primitives drawn by the vertex buffer
|
||||
///
|
||||
/// \param vertexBuffer Vertex buffer object
|
||||
///
|
||||
/// \return Primitive type
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfPrimitiveType sfVertexBuffer_getPrimitiveType(const sfVertexBuffer* vertexBuffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the usage specifier of this vertex buffer
|
||||
///
|
||||
/// This function provides a hint about how this vertex buffer is
|
||||
/// going to be used in terms of data update frequency.
|
||||
///
|
||||
/// After changing the usage specifier, the vertex buffer has
|
||||
/// to be updated with new data for the usage specifier to
|
||||
/// take effect.
|
||||
///
|
||||
/// The default primitive type is sfVertexBufferStream.
|
||||
///
|
||||
/// \param vertexBuffer Vertex buffer object
|
||||
/// \param usage Usage specifier
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfVertexBuffer_setUsage(sfVertexBuffer* vertexBuffer, sfVertexBufferUsage usage);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the usage specifier of this vertex buffer
|
||||
///
|
||||
/// \param vertexBuffer Vertex buffer object
|
||||
///
|
||||
/// \return Usage specifier
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVertexBufferUsage sfVertexBuffer_getUsage(const sfVertexBuffer* vertexBuffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Bind a vertex buffer for rendering
|
||||
///
|
||||
/// This function is not part of the graphics API, it mustn't be
|
||||
/// used when drawing SFML entities. It must be used only if you
|
||||
/// mix sfVertexBuffer with OpenGL code.
|
||||
///
|
||||
/// \code
|
||||
/// sfVertexBuffer* vb1, vb2;
|
||||
/// ...
|
||||
/// sfVertexBuffer_bind(vb1);
|
||||
/// // draw OpenGL stuff that use vb1...
|
||||
/// sfVertexBuffer_bind(vb2);
|
||||
/// // draw OpenGL stuff that use vb2...
|
||||
/// sfVertexBuffer_bind(NULL);
|
||||
/// // draw OpenGL stuff that use no vertex buffer...
|
||||
/// \endcode
|
||||
///
|
||||
/// \param vertexBuffer Pointer to the vertex buffer to bind, can be null to use no vertex buffer
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfVertexBuffer_bind(const sfVertexBuffer* vertexBuffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether or not the system supports vertex buffers
|
||||
///
|
||||
/// This function should always be called before using
|
||||
/// the vertex buffer features. If it returns false, then
|
||||
/// any attempt to use sfVertexBuffer will fail.
|
||||
///
|
||||
/// \return True if vertex buffers are supported, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API bool sfVertexBuffer_isAvailable(void);
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,16 +22,16 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_VIEW_H
|
||||
#define SFML_VIEW_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Graphics/Export.h>
|
||||
#include <SFML/Graphics/Rect.h>
|
||||
#include <SFML/Graphics/Types.h>
|
||||
#include <SFML/System/Vector2.h>
|
||||
#include <CSFML/Graphics/Export.h>
|
||||
|
||||
#include <CSFML/Graphics/Rect.h>
|
||||
#include <CSFML/Graphics/Types.h>
|
||||
#include <CSFML/System/Vector2.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -62,7 +62,7 @@ CSFML_GRAPHICS_API sfView* sfView_createFromRect(sfFloatRect rectangle);
|
||||
/// \return Copied object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfView* sfView_copy(sfView* view);
|
||||
CSFML_GRAPHICS_API sfView* sfView_copy(const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destroy an existing view
|
||||
@@ -70,7 +70,7 @@ CSFML_GRAPHICS_API sfView* sfView_copy(sfView* view);
|
||||
/// \param view View to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfView_destroy(sfView* view);
|
||||
CSFML_GRAPHICS_API void sfView_destroy(const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the center of a view
|
||||
@@ -118,15 +118,27 @@ CSFML_GRAPHICS_API void sfView_setRotation(sfView* view, float angle);
|
||||
CSFML_GRAPHICS_API void sfView_setViewport(sfView* view, sfFloatRect viewport);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Reset a view to the given rectangle
|
||||
/// \brief Set the target scissor rectangle
|
||||
///
|
||||
/// Note that this function resets the rotation angle to 0.
|
||||
/// The scissor rectangle, expressed as a factor (between 0 and 1) of
|
||||
/// the RenderTarget, specifies the region of the RenderTarget whose
|
||||
/// pixels are able to be modified by draw or clear operations.
|
||||
/// Any pixels which lie outside of the scissor rectangle will
|
||||
/// not be modified by draw or clear operations.
|
||||
/// For example, a scissor rectangle which only allows modifications
|
||||
/// to the right side of the target would be defined
|
||||
/// with `sfView_setScissor(view, (sfFloatRect){{0.5f, 0.f}, {0.5f, 1.f}})`.
|
||||
/// By default, a view has a scissor rectangle which allows
|
||||
/// modifications to the entire target. This is equivalent to
|
||||
/// disabling the scissor test entirely. Passing the default
|
||||
/// scissor rectangle to this function will also disable
|
||||
/// scissor testing.
|
||||
///
|
||||
/// \param view View object
|
||||
/// \param rectangle Rectangle defining the zone to display
|
||||
/// \param view View object
|
||||
/// \param scissor New scissor rectangle
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfView_reset(sfView* view, sfFloatRect rectangle);
|
||||
CSFML_GRAPHICS_API void sfView_setScissor(sfView* view, sfFloatRect scissor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the center of a view
|
||||
@@ -168,6 +180,16 @@ CSFML_GRAPHICS_API float sfView_getRotation(const sfView* view);
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfFloatRect sfView_getViewport(const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the scissor rectangle of the view
|
||||
///
|
||||
/// \param view View object
|
||||
///
|
||||
/// \return Scissor rectangle, expressed as a factor of the target size
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfFloatRect sfView_getScissor(const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Move a view relatively to its current position
|
||||
///
|
||||
@@ -201,6 +223,3 @@ CSFML_GRAPHICS_API void sfView_rotate(sfView* view, float angle);
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfView_zoom(sfView* view, float factor);
|
||||
|
||||
|
||||
#endif // SFML_VIEW_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,21 +22,19 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SFML_WINDOW_H
|
||||
#define SFML_SFML_WINDOW_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#include <SFML/System.h>
|
||||
#include <SFML/Window/Context.h>
|
||||
#include <SFML/Window/Event.h>
|
||||
#include <SFML/Window/Joystick.h>
|
||||
#include <SFML/Window/Keyboard.h>
|
||||
#include <SFML/Window/Mouse.h>
|
||||
#include <SFML/Window/VideoMode.h>
|
||||
#include <SFML/Window/Window.h>
|
||||
|
||||
|
||||
#endif // SFML_SFML_WINDOW_H
|
||||
#include <CSFML/Network/Ftp.h>
|
||||
#include <CSFML/Network/Http.h>
|
||||
#include <CSFML/Network/IpAddress.h>
|
||||
#include <CSFML/Network/Packet.h>
|
||||
#include <CSFML/Network/SocketSelector.h>
|
||||
#include <CSFML/Network/SocketStatus.h>
|
||||
#include <CSFML/Network/TcpListener.h>
|
||||
#include <CSFML/Network/TcpSocket.h>
|
||||
#include <CSFML/Network/UdpSocket.h>
|
||||
#include <CSFML/System.h>
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,13 +22,12 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_NETWORK_EXPORT_H
|
||||
#define SFML_NETWORK_EXPORT_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <CSFML/Config.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -36,13 +35,10 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
#if defined(CSFML_NETWORK_EXPORTS)
|
||||
|
||||
#define CSFML_NETWORK_API CSFML_API_EXPORT
|
||||
#define CSFML_NETWORK_API CSFML_API_EXPORT
|
||||
|
||||
#else
|
||||
|
||||
#define CSFML_NETWORK_API CSFML_API_IMPORT
|
||||
#define CSFML_NETWORK_API CSFML_API_IMPORT
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif // SFML_NETWORK_EXPORT_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,15 +22,16 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_FTP_H
|
||||
#define SFML_FTP_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Network/Export.h>
|
||||
#include <SFML/Network/IpAddress.h>
|
||||
#include <SFML/Network/Types.h>
|
||||
#include <CSFML/Network/Export.h>
|
||||
|
||||
#include <CSFML/Network/IpAddress.h>
|
||||
#include <CSFML/Network/Types.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
@@ -38,19 +39,19 @@
|
||||
/// \brief Enumeration of transfer modes
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum sfFtpTransferMode
|
||||
typedef enum
|
||||
{
|
||||
sfFtpBinary, ///< Binary mode (file is transfered as a sequence of bytes)
|
||||
sfFtpBinary, ///< Binary mode (file is transferred as a sequence of bytes)
|
||||
sfFtpAscii, ///< Text mode using ASCII encoding
|
||||
sfFtpEbcdic ///< Text mode using EBCDIC encoding
|
||||
};
|
||||
} sfFtpTransferMode;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Status codes possibly returned by a FTP response
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum sfFtpStatus
|
||||
typedef enum
|
||||
{
|
||||
// 1xx: the requested action is being initiated,
|
||||
// expect another reply before proceeding with a new command
|
||||
@@ -60,13 +61,13 @@ enum sfFtpStatus
|
||||
sfFtpOpeningDataConnection = 150, ///< File status ok, about to open data connection
|
||||
|
||||
// 2xx: the requested action has been successfully completed
|
||||
sfFtpOk = 200, ///< Command ok
|
||||
sfFtpPointlessCommand = 202, ///< Command not implemented
|
||||
sfFtpSystemStatus = 211, ///< System status, or system help reply
|
||||
sfFtpDirectoryStatus = 212, ///< Directory status
|
||||
sfFtpFileStatus = 213, ///< File status
|
||||
sfFtpHelpMessage = 214, ///< Help message
|
||||
sfFtpSystemType = 215, ///< NAME system type, where NAME is an official system name from the list in the Assigned Numbers document
|
||||
sfFtpOk = 200, ///< Command ok
|
||||
sfFtpPointlessCommand = 202, ///< Command not implemented
|
||||
sfFtpSystemStatus = 211, ///< System status, or system help reply
|
||||
sfFtpDirectoryStatus = 212, ///< Directory status
|
||||
sfFtpFileStatus = 213, ///< File status
|
||||
sfFtpHelpMessage = 214, ///< Help message
|
||||
sfFtpSystemType = 215, ///< NAME system type, where NAME is an official system name from the list in the Assigned Numbers document
|
||||
sfFtpServiceReady = 220, ///< Service ready for new user
|
||||
sfFtpClosingConnection = 221, ///< Service closing control connection
|
||||
sfFtpDataConnectionOpened = 225, ///< Data connection open, no transfer in progress
|
||||
@@ -89,7 +90,7 @@ enum sfFtpStatus
|
||||
sfFtpTransferAborted = 426, ///< Connection closed, transfer aborted
|
||||
sfFtpFileActionAborted = 450, ///< Requested file action not taken
|
||||
sfFtpLocalError = 451, ///< Requested action aborted, local error in processing
|
||||
sfFtpInsufficientStorageSpace = 452, ///< Requested action not taken; insufficient storage space in system, file unavailable
|
||||
sfFtpInsufficientStorageSpace = 452, ///< Requested action not taken; insufficient storage space in system, file unavailable
|
||||
|
||||
// 5xx: the command was not accepted and
|
||||
// the requested action did not take place
|
||||
@@ -110,7 +111,7 @@ enum sfFtpStatus
|
||||
sfFtpConnectionFailed = 1001, ///< Connection with server failed
|
||||
sfFtpConnectionClosed = 1002, ///< Connection with server closed
|
||||
sfFtpInvalidFile = 1003 ///< Invalid file to upload / download
|
||||
};
|
||||
} sfFtpStatus;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -119,7 +120,7 @@ enum sfFtpStatus
|
||||
/// \param ftpListingResponse Ftp listing response to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API void sfFtpListingResponse_destroy(sfFtpListingResponse* ftpListingResponse);
|
||||
CSFML_NETWORK_API void sfFtpListingResponse_destroy(const sfFtpListingResponse* ftpListingResponse);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check if a FTP listing response status code means a success
|
||||
@@ -129,10 +130,10 @@ CSFML_NETWORK_API void sfFtpListingResponse_destroy(sfFtpListingResponse* ftpLis
|
||||
///
|
||||
/// \param ftpListingResponse Ftp listing response
|
||||
///
|
||||
/// \return sfTrue if the status is a success, sfFalse if it is a failure
|
||||
/// \return true if the status is a success, false if it is a failure
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfBool sfFtpListingResponse_isOk(const sfFtpListingResponse* ftpListingResponse);
|
||||
CSFML_NETWORK_API bool sfFtpListingResponse_isOk(const sfFtpListingResponse* ftpListingResponse);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the status code of a FTP listing response
|
||||
@@ -155,25 +156,25 @@ CSFML_NETWORK_API sfFtpStatus sfFtpListingResponse_getStatus(const sfFtpListingR
|
||||
CSFML_NETWORK_API const char* sfFtpListingResponse_getMessage(const sfFtpListingResponse* ftpListingResponse);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return the number of filenames contained in a FTP listing response
|
||||
/// \brief Return the number of directory/file names contained in a FTP listing response
|
||||
///
|
||||
/// \param ftpListingResponse Ftp listing response
|
||||
///
|
||||
/// \return Total number of filenames available
|
||||
/// \return Total number of names available
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API size_t sfFtpListingResponse_getCount(const sfFtpListingResponse* ftpListingResponse);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return a filename contained in a FTP listing response
|
||||
/// \brief Return a directory/file name contained in a FTP listing response
|
||||
///
|
||||
/// \param ftpListingResponse Ftp listing response
|
||||
/// \param index Index of the filename to get (in range [0 .. GetCount])
|
||||
/// \param index Index of the name to get, in range [0 .. getCount() - 1]
|
||||
///
|
||||
/// \return Array containing the requested filenames
|
||||
/// \return The requested name
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API const char* sfFtpListingResponse_getFilename(const sfFtpListingResponse* ftpListingResponse, size_t index);
|
||||
CSFML_NETWORK_API const char* sfFtpListingResponse_getName(const sfFtpListingResponse* ftpListingResponse, size_t index);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destroy a FTP directory response
|
||||
@@ -181,7 +182,7 @@ CSFML_NETWORK_API const char* sfFtpListingResponse_getFilename(const sfFtpListin
|
||||
/// \param ftpDirectoryResponse Ftp directory response to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API void sfFtpDirectoryResponse_destroy(sfFtpDirectoryResponse* ftpDirectoryResponse);
|
||||
CSFML_NETWORK_API void sfFtpDirectoryResponse_destroy(const sfFtpDirectoryResponse* ftpDirectoryResponse);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check if a FTP directory response status code means a success
|
||||
@@ -191,10 +192,10 @@ CSFML_NETWORK_API void sfFtpDirectoryResponse_destroy(sfFtpDirectoryResponse* ft
|
||||
///
|
||||
/// \param ftpDirectoryResponse Ftp directory response
|
||||
///
|
||||
/// \return sfTrue if the status is a success, sfFalse if it is a failure
|
||||
/// \return true if the status is a success, false if it is a failure
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfBool sfFtpDirectoryResponse_isOk(const sfFtpDirectoryResponse* ftpDirectoryResponse);
|
||||
CSFML_NETWORK_API bool sfFtpDirectoryResponse_isOk(const sfFtpDirectoryResponse* ftpDirectoryResponse);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the status code of a FTP directory response
|
||||
@@ -219,21 +220,38 @@ CSFML_NETWORK_API const char* sfFtpDirectoryResponse_getMessage(const sfFtpDirec
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the directory returned in a FTP directory response
|
||||
///
|
||||
/// The returned const char* owns the string and must be freed to
|
||||
/// avoid memory leaks.
|
||||
///
|
||||
/// \param ftpDirectoryResponse Ftp directory response
|
||||
///
|
||||
/// \return Directory name
|
||||
/// \return Directory name or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API const char* sfFtpDirectoryResponse_getDirectory(const sfFtpDirectoryResponse* ftpDirectoryResponse);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the directory returned in a FTP directory response
|
||||
///
|
||||
/// The returned const sfChar32* owns the string and must be freed to
|
||||
/// avoid memory leaks.
|
||||
///
|
||||
/// \param ftpDirectoryResponse Ftp directory response
|
||||
///
|
||||
/// \return Directory name or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API const sfChar32* sfFtpDirectoryResponse_getDirectoryUnicode(const sfFtpDirectoryResponse* ftpDirectoryResponse);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destroy a FTP response
|
||||
///
|
||||
/// \param ftpResponse Ftp response to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API void sfFtpResponse_destroy(sfFtpResponse* ftpResponse);
|
||||
CSFML_NETWORK_API void sfFtpResponse_destroy(const sfFtpResponse* ftpResponse);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check if a FTP response status code means a success
|
||||
@@ -243,10 +261,10 @@ CSFML_NETWORK_API void sfFtpResponse_destroy(sfFtpResponse* ftpResponse);
|
||||
///
|
||||
/// \param ftpResponse Ftp response object
|
||||
///
|
||||
/// \return sfTrue if the status is a success, sfFalse if it is a failure
|
||||
/// \return true if the status is a success, false if it is a failure
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfBool sfFtpResponse_isOk(const sfFtpResponse* ftpResponse);
|
||||
CSFML_NETWORK_API bool sfFtpResponse_isOk(const sfFtpResponse* ftpResponse);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the status code of a FTP response
|
||||
@@ -282,7 +300,7 @@ CSFML_NETWORK_API sfFtp* sfFtp_create(void);
|
||||
/// \param ftp Ftp object to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API void sfFtp_destroy(sfFtp* ftp);
|
||||
CSFML_NETWORK_API void sfFtp_destroy(const sfFtp* ftp);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Connect to the specified FTP server
|
||||
@@ -299,12 +317,12 @@ CSFML_NETWORK_API void sfFtp_destroy(sfFtp* ftp);
|
||||
/// \param ftp Ftp object
|
||||
/// \param server Name or address of the FTP server to connect to
|
||||
/// \param port Port used for the connection
|
||||
/// \param timeout Maximum time to wait, in milliseconds
|
||||
/// \param timeout Maximum time to wait
|
||||
///
|
||||
/// \return Server response to the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfFtpResponse* sfFtp_connect(sfFtp* ftp, sfIpAddress server, unsigned short port, sfUint32 timeout);
|
||||
CSFML_NETWORK_API sfFtpResponse* sfFtp_connect(sfFtp* ftp, sfIpAddress server, unsigned short port, sfTime timeout);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Log in using an anonymous account
|
||||
@@ -332,7 +350,7 @@ CSFML_NETWORK_API sfFtpResponse* sfFtp_loginAnonymous(sfFtp* ftp);
|
||||
/// \return Server response to the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfFtpResponse* sfFtp_login(sfFtp* ftp, const char* userName, const char* password);
|
||||
CSFML_NETWORK_API sfFtpResponse* sfFtp_login(sfFtp* ftp, const char* name, const char* password);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Close the connection with the server
|
||||
@@ -486,7 +504,7 @@ CSFML_NETWORK_API sfFtpResponse* sfFtp_deleteFile(sfFtp* ftp, const char* name);
|
||||
/// \return Server response to the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfFtpResponse* sfFtp_download(sfFtp* ftp, const char* distantFile, const char* destPath, sfFtpTransferMode mode);
|
||||
CSFML_NETWORK_API sfFtpResponse* sfFtp_download(sfFtp* ftp, const char* remoteFile, const char* localPath, sfFtpTransferMode mode);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Upload a file to a FTP server
|
||||
@@ -500,11 +518,34 @@ CSFML_NETWORK_API sfFtpResponse* sfFtp_download(sfFtp* ftp, const char* distantF
|
||||
/// \param localFile Path of the local file to upload
|
||||
/// \param remotePath Where to put to file on the server
|
||||
/// \param mode Transfer mode
|
||||
/// \param append Pass true to append to or false to overwrite the remote file if it already exists
|
||||
///
|
||||
/// \return Server response to the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfFtpResponse* sfFtp_upload(sfFtp* ftp, const char* localFile, const char* destPath, sfFtpTransferMode mode);
|
||||
CSFML_NETWORK_API sfFtpResponse* sfFtp_upload(
|
||||
sfFtp* ftp,
|
||||
const char* localFile,
|
||||
const char* remotePath,
|
||||
sfFtpTransferMode mode,
|
||||
bool append);
|
||||
|
||||
|
||||
#endif // SFML_FTP_H
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Send a command to the FTP server
|
||||
///
|
||||
/// While the most often used commands are provided as
|
||||
/// specific functions, this function can be used to send
|
||||
/// any FTP command to the server. If the command requires
|
||||
/// one or more parameters, they can be specified in
|
||||
/// \a parameter. Otherwise you should pass NULL.
|
||||
/// If the server returns information, you can extract it
|
||||
/// from the response using sfResponse_getMessage().
|
||||
///
|
||||
/// \param ftp Ftp object
|
||||
/// \param command Command to send
|
||||
/// \param parameter Command parameter
|
||||
///
|
||||
/// \return Server response to the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfFtpResponse* sfFtp_sendCommand(sfFtp* ftp, const char* command, const char* parameter);
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,63 +22,70 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_HTTP_H
|
||||
#define SFML_HTTP_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Network/Export.h>
|
||||
#include <SFML/Network/Types.h>
|
||||
#include <SFML/System/Time.h>
|
||||
#include <CSFML/Network/Export.h>
|
||||
|
||||
#include <CSFML/Network/Types.h>
|
||||
#include <CSFML/System/Time.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Enumerate the available HTTP methods for a request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum sfHttpMethod
|
||||
typedef enum
|
||||
{
|
||||
sfHttpGet, ///< Request in get mode, standard method to retrieve a page
|
||||
sfHttpPost, ///< Request in post mode, usually to send data to a page
|
||||
sfHttpHead ///< Request a page's header only
|
||||
};
|
||||
sfHttpGet, ///< Request in get mode, standard method to retrieve a page
|
||||
sfHttpPost, ///< Request in post mode, usually to send data to a page
|
||||
sfHttpHead, ///< Request a page's header only
|
||||
sfHttpPut, ///< Request in put mode, useful for a REST API
|
||||
sfHttpDelete ///< Request in delete mode, useful for a REST API
|
||||
} sfHttpMethod;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Enumerate all the valid status codes for a response
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum sfHttpStatus
|
||||
typedef enum
|
||||
{
|
||||
// 2xx: success
|
||||
sfHttpOk = 200, ///< Most common code returned when operation was successful
|
||||
sfHttpCreated = 201, ///< The resource has successfully been created
|
||||
sfHttpAccepted = 202, ///< The request has been accepted, but will be processed later by the server
|
||||
sfHttpNoContent = 204, ///< Sent when the server didn't send any data in return
|
||||
sfHttpResetContent = 205, ///< The server informs the client that it should clear the view (form) that caused the request to be sent
|
||||
sfHttpPartialContent = 206, ///< The server has sent a part of the resource, as a response to a partial GET request
|
||||
|
||||
// 3xx: redirection
|
||||
sfHttpMultipleChoices = 300, ///< The requested page can be accessed from several locations
|
||||
sfHttpMovedPermanently = 301, ///< The requested page has permanently moved to a new location
|
||||
sfHttpMovedTemporarily = 302, ///< The requested page has temporarily moved to a new location
|
||||
sfHttpNotModified = 304, ///< For conditionnal requests, means the requested page hasn't changed and doesn't need to be refreshed
|
||||
sfHttpNotModified = 304, ///< For conditional requests, means the requested page hasn't changed and doesn't need to be refreshed
|
||||
|
||||
// 4xx: client error
|
||||
sfHttpBadRequest = 400, ///< The server couldn't understand the request (syntax error)
|
||||
sfHttpUnauthorized = 401, ///< The requested page needs an authentification to be accessed
|
||||
sfHttpForbidden = 403, ///< The requested page cannot be accessed at all, even with authentification
|
||||
sfHttpNotFound = 404, ///< The requested page doesn't exist
|
||||
sfHttpBadRequest = 400, ///< The server couldn't understand the request (syntax error)
|
||||
sfHttpUnauthorized = 401, ///< The requested page needs an authentication to be accessed
|
||||
sfHttpForbidden = 403, ///< The requested page cannot be accessed at all, even with authentication
|
||||
sfHttpNotFound = 404, ///< The requested page doesn't exist
|
||||
sfHttpRangeNotSatisfiable = 407, ///< The server can't satisfy the partial GET request (with a "Range" header field)
|
||||
|
||||
// 5xx: server error
|
||||
sfHttpInternalServerError = 500, ///< The server encountered an unexpected error
|
||||
sfHttpNotImplemented = 501, ///< The server doesn't implement a requested feature
|
||||
sfHttpBadGateway = 502, ///< The gateway server has received an error from the source server
|
||||
sfHttpServiceNotAvailable = 503, ///< The server is temporarily unavailable (overloaded, in maintenance, ...)
|
||||
sfHttpGatewayTimeout = 504, ///< The gateway server couldn't receive a response from the source server
|
||||
sfHttpVersionNotSupported = 505, ///< The server doesn't support the requested HTTP version
|
||||
|
||||
// 10xx: SFML custom codes
|
||||
sfHttpInvalidResponse = 1000, ///< Response is not a valid HTTP one
|
||||
sfHttpConnectionFailed = 1001 ///< Connection with server failed
|
||||
};
|
||||
} sfHttpStatus;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -95,7 +102,7 @@ CSFML_NETWORK_API sfHttpRequest* sfHttpRequest_create(void);
|
||||
/// \param httpRequest HTTP request to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API void sfHttpRequest_destroy(sfHttpRequest* httpRequest);
|
||||
CSFML_NETWORK_API void sfHttpRequest_destroy(const sfHttpRequest* httpRequest);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the value of a header field of a HTTP request
|
||||
@@ -117,7 +124,7 @@ CSFML_NETWORK_API void sfHttpRequest_setField(sfHttpRequest* httpRequest, const
|
||||
/// \brief Set a HTTP request method
|
||||
///
|
||||
/// See the sfHttpMethod enumeration for a complete list of all
|
||||
/// the availale methods.
|
||||
/// the available methods.
|
||||
/// The method is sfHttpGet by default.
|
||||
///
|
||||
/// \param httpRequest HTTP request
|
||||
@@ -170,7 +177,7 @@ CSFML_NETWORK_API void sfHttpRequest_setBody(sfHttpRequest* httpRequest, const c
|
||||
/// \param httpResponse HTTP response to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API void sfHttpResponse_destroy(sfHttpResponse* httpResponse);
|
||||
CSFML_NETWORK_API void sfHttpResponse_destroy(const sfHttpResponse* httpResponse);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the value of a field of a HTTP response
|
||||
@@ -188,7 +195,7 @@ CSFML_NETWORK_API void sfHttpResponse_destroy(sfHttpResponse* httpResponse);
|
||||
CSFML_NETWORK_API const char* sfHttpResponse_getField(const sfHttpResponse* httpResponse, const char* field);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the status code of a HTTP reponse
|
||||
/// \brief Get the status code of a HTTP response
|
||||
///
|
||||
/// The status code should be the first thing to be checked
|
||||
/// after receiving a response, it defines whether it is a
|
||||
@@ -252,7 +259,7 @@ CSFML_NETWORK_API sfHttp* sfHttp_create(void);
|
||||
/// \param http Http object to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API void sfHttp_destroy(sfHttp* http);
|
||||
CSFML_NETWORK_API void sfHttp_destroy(const sfHttp* http);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the target host of a HTTP object
|
||||
@@ -275,13 +282,13 @@ CSFML_NETWORK_API void sfHttp_setHost(sfHttp* http, const char* host, unsigned s
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Send a HTTP request and return the server's response.
|
||||
///
|
||||
/// You must have a valid host before sending a request (see sfHttp_SetHost).
|
||||
/// You must have a valid host before sending a request (see sfHttp_setHost).
|
||||
/// Any missing mandatory header field in the request will be added
|
||||
/// with an appropriate value.
|
||||
/// Warning: this function waits for the server's response and may
|
||||
/// not return instantly; use a thread if you don't want to block your
|
||||
/// application, or use a timeout to limit the time to wait. A value
|
||||
/// of 0 means that the client will use the system defaut timeout
|
||||
/// of 0 means that the client will use the system default timeout
|
||||
/// (which is usually pretty long).
|
||||
///
|
||||
/// \param http Http object
|
||||
@@ -292,6 +299,3 @@ CSFML_NETWORK_API void sfHttp_setHost(sfHttp* http, const char* host, unsigned s
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfHttpResponse* sfHttp_sendRequest(sfHttp* http, const sfHttpRequest* request, sfTime timeout);
|
||||
|
||||
|
||||
#endif // SFML_HTTP_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,14 +22,14 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_IPADDRESS_H
|
||||
#define SFML_IPADDRESS_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Network/Export.h>
|
||||
#include <SFML/System/Time.h>
|
||||
#include <CSFML/Network/Export.h>
|
||||
|
||||
#include <CSFML/System/Time.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -46,19 +46,25 @@ typedef struct
|
||||
/// \brief Empty object that represents invalid addresses
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfIpAddress sfIpAddress_None;
|
||||
CSFML_NETWORK_API const sfIpAddress sfIpAddress_None;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Value representing any address (0.0.0.0)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API const sfIpAddress sfIpAddress_Any;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Local host IP address (127.0.0.1, or "localhost")
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfIpAddress sfIpAddress_LocalHost;
|
||||
CSFML_NETWORK_API const sfIpAddress sfIpAddress_LocalHost;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief UDP broadcast address (255.255.255.255)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfIpAddress sfIpAddress_Broadcast;
|
||||
CSFML_NETWORK_API const sfIpAddress sfIpAddress_Broadcast;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create an address from a string
|
||||
@@ -89,7 +95,7 @@ CSFML_NETWORK_API sfIpAddress sfIpAddress_fromString(const char* address);
|
||||
/// \return Resulting address
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfIpAddress sfIpAddress_fromBytes(sfUint8 byte0, sfUint8 byte1, sfUint8 byte2, sfUint8 byte3);
|
||||
CSFML_NETWORK_API sfIpAddress sfIpAddress_fromBytes(uint8_t byte0, uint8_t byte1, uint8_t byte2, uint8_t byte3);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Construct an address from a 32-bits integer
|
||||
@@ -97,14 +103,14 @@ CSFML_NETWORK_API sfIpAddress sfIpAddress_fromBytes(sfUint8 byte0, sfUint8 byte1
|
||||
/// This function uses the internal representation of
|
||||
/// the address directly. It should be used for optimization
|
||||
/// purposes, and only if you got that representation from
|
||||
/// sfIpAddress_ToInteger.
|
||||
/// sfIpAddress_toInteger.
|
||||
///
|
||||
/// \param address 4 bytes of the address packed into a 32-bits integer
|
||||
///
|
||||
/// \return Resulting address
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfIpAddress sfIpAddress_fromInteger(sfUint32 address);
|
||||
CSFML_NETWORK_API sfIpAddress sfIpAddress_fromInteger(uint32_t address);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get a string representation of an address
|
||||
@@ -114,8 +120,7 @@ CSFML_NETWORK_API sfIpAddress sfIpAddress_fromInteger(sfUint32 address);
|
||||
/// from a host name.
|
||||
///
|
||||
/// \param address Address object
|
||||
///
|
||||
/// \return String representation of the address
|
||||
/// \param string String where the string representation will be stored
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API void sfIpAddress_toString(sfIpAddress address, char* string);
|
||||
@@ -134,7 +139,7 @@ CSFML_NETWORK_API void sfIpAddress_toString(sfIpAddress address, char* string);
|
||||
/// \return 32-bits unsigned integer representation of the address
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfUint32 sfIpAddress_toInteger(sfIpAddress address);
|
||||
CSFML_NETWORK_API uint32_t sfIpAddress_toInteger(sfIpAddress address);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the computer's local address
|
||||
@@ -171,6 +176,3 @@ CSFML_NETWORK_API sfIpAddress sfIpAddress_getLocalAddress(void);
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfIpAddress sfIpAddress_getPublicAddress(sfTime timeout);
|
||||
|
||||
|
||||
#endif // SFML_IPADDRESS_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,14 +22,15 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_PACKET_H
|
||||
#define SFML_PACKET_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Network/Export.h>
|
||||
#include <SFML/Network/Types.h>
|
||||
#include <CSFML/Network/Export.h>
|
||||
|
||||
#include <CSFML/Network/Types.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
@@ -49,7 +50,7 @@ CSFML_NETWORK_API sfPacket* sfPacket_create(void);
|
||||
/// \return A new sfPacket object which is a copy of \a packet
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfPacket* sfPacket_copy(sfPacket* packet);
|
||||
CSFML_NETWORK_API sfPacket* sfPacket_copy(const sfPacket* packet);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destroy a packet
|
||||
@@ -57,7 +58,7 @@ CSFML_NETWORK_API sfPacket* sfPacket_copy(sfPacket* packet);
|
||||
/// \param packet Packet to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API void sfPacket_destroy(sfPacket* packet);
|
||||
CSFML_NETWORK_API void sfPacket_destroy(const sfPacket* packet);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Append data to the end of a packet
|
||||
@@ -69,6 +70,18 @@ CSFML_NETWORK_API void sfPacket_destroy(sfPacket* packet);
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API void sfPacket_append(sfPacket* packet, const void* data, size_t sizeInBytes);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current reading position in the packet
|
||||
///
|
||||
/// The next read operation will read data from this position
|
||||
///
|
||||
/// \return The byte offset of the current read position
|
||||
///
|
||||
/// \see append
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API size_t sfPacket_getReadPosition(const sfPacket* packet);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Clear a packet
|
||||
///
|
||||
@@ -116,15 +129,15 @@ CSFML_NETWORK_API size_t sfPacket_getDataSize(const sfPacket* packet);
|
||||
///
|
||||
/// \param packet Packet object
|
||||
///
|
||||
/// \return sfTrue if all data was read, sfFalse otherwise
|
||||
/// \return true if all data was read, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfBool sfPacket_endOfPacket(const sfPacket* packet);
|
||||
CSFML_NETWORK_API bool sfPacket_endOfPacket(const sfPacket* packet);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Test the validity of a packet, for reading
|
||||
///
|
||||
/// This function allows to test the packet, to check if
|
||||
/// This function allows for testing the packet, to check if
|
||||
/// a reading operation was successful.
|
||||
///
|
||||
/// A packet will be in an invalid state if it has no more
|
||||
@@ -132,10 +145,10 @@ CSFML_NETWORK_API sfBool sfPacket_endOfPacket(const sfPacket* packet);
|
||||
///
|
||||
/// \param packet Packet object
|
||||
///
|
||||
/// \return sfTrue if last data extraction from packet was successful
|
||||
/// \return true if last data extraction from packet was successful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfBool sfPacket_canRead(const sfPacket* packet);
|
||||
CSFML_NETWORK_API bool sfPacket_canRead(const sfPacket* packet);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Functions to extract data from a packet
|
||||
@@ -143,13 +156,13 @@ CSFML_NETWORK_API sfBool sfPacket_canRead(const sfPacket* packet);
|
||||
/// \param packet Packet object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfBool sfPacket_readBool(sfPacket* packet);
|
||||
CSFML_NETWORK_API sfInt8 sfPacket_readInt8(sfPacket* packet);
|
||||
CSFML_NETWORK_API sfUint8 sfPacket_readUint8(sfPacket* packet);
|
||||
CSFML_NETWORK_API sfInt16 sfPacket_readInt16(sfPacket* packet);
|
||||
CSFML_NETWORK_API sfUint16 sfPacket_readUint16(sfPacket* packet);
|
||||
CSFML_NETWORK_API sfInt32 sfPacket_readInt32(sfPacket* packet);
|
||||
CSFML_NETWORK_API sfUint32 sfPacket_readUint32(sfPacket* packet);
|
||||
CSFML_NETWORK_API bool sfPacket_readBool(sfPacket* packet);
|
||||
CSFML_NETWORK_API int8_t sfPacket_readInt8(sfPacket* packet);
|
||||
CSFML_NETWORK_API uint8_t sfPacket_readUint8(sfPacket* packet);
|
||||
CSFML_NETWORK_API int16_t sfPacket_readInt16(sfPacket* packet);
|
||||
CSFML_NETWORK_API uint16_t sfPacket_readUint16(sfPacket* packet);
|
||||
CSFML_NETWORK_API int32_t sfPacket_readInt32(sfPacket* packet);
|
||||
CSFML_NETWORK_API uint32_t sfPacket_readUint32(sfPacket* packet);
|
||||
CSFML_NETWORK_API float sfPacket_readFloat(sfPacket* packet);
|
||||
CSFML_NETWORK_API double sfPacket_readDouble(sfPacket* packet);
|
||||
CSFML_NETWORK_API void sfPacket_readString(sfPacket* packet, char* string);
|
||||
@@ -161,17 +174,14 @@ CSFML_NETWORK_API void sfPacket_readWideString(sfPacket* packet, wchar_t* st
|
||||
/// \param packet Packet object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API void sfPacket_writeBool(sfPacket* packet, sfBool);
|
||||
CSFML_NETWORK_API void sfPacket_writeInt8(sfPacket* packet, sfInt8);
|
||||
CSFML_NETWORK_API void sfPacket_writeUint8(sfPacket* packet, sfUint8);
|
||||
CSFML_NETWORK_API void sfPacket_writeInt16(sfPacket* packet, sfInt16);
|
||||
CSFML_NETWORK_API void sfPacket_writeUint16(sfPacket* packet, sfUint16);
|
||||
CSFML_NETWORK_API void sfPacket_writeInt32(sfPacket* packet, sfInt32);
|
||||
CSFML_NETWORK_API void sfPacket_writeUint32(sfPacket* packet, sfUint32);
|
||||
CSFML_NETWORK_API void sfPacket_writeBool(sfPacket* packet, bool);
|
||||
CSFML_NETWORK_API void sfPacket_writeInt8(sfPacket* packet, int8_t);
|
||||
CSFML_NETWORK_API void sfPacket_writeUint8(sfPacket* packet, uint8_t);
|
||||
CSFML_NETWORK_API void sfPacket_writeInt16(sfPacket* packet, int16_t);
|
||||
CSFML_NETWORK_API void sfPacket_writeUint16(sfPacket* packet, uint16_t);
|
||||
CSFML_NETWORK_API void sfPacket_writeInt32(sfPacket* packet, int32_t);
|
||||
CSFML_NETWORK_API void sfPacket_writeUint32(sfPacket* packet, uint32_t);
|
||||
CSFML_NETWORK_API void sfPacket_writeFloat(sfPacket* packet, float);
|
||||
CSFML_NETWORK_API void sfPacket_writeDouble(sfPacket* packet, double);
|
||||
CSFML_NETWORK_API void sfPacket_writeString(sfPacket* packet, const char* string);
|
||||
CSFML_NETWORK_API void sfPacket_writeWideString(sfPacket* packet, const wchar_t* string);
|
||||
|
||||
|
||||
#endif // SFML_PACKET_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,15 +22,15 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SOCKETSELECTOR_H
|
||||
#define SFML_SOCKETSELECTOR_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Network/Export.h>
|
||||
#include <SFML/Network/Types.h>
|
||||
#include <SFML/System/Time.h>
|
||||
#include <CSFML/Network/Export.h>
|
||||
|
||||
#include <CSFML/Network/Types.h>
|
||||
#include <CSFML/System/Time.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -49,7 +49,7 @@ CSFML_NETWORK_API sfSocketSelector* sfSocketSelector_create(void);
|
||||
/// \return A new sfSocketSelector object which is a copy of \a selector
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfSocketSelector* sfSocketSelector_copy(sfSocketSelector* selector);
|
||||
CSFML_NETWORK_API sfSocketSelector* sfSocketSelector_copy(const sfSocketSelector* selector);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destroy a socket selector
|
||||
@@ -57,7 +57,7 @@ CSFML_NETWORK_API sfSocketSelector* sfSocketSelector_copy(sfSocketSelector* sele
|
||||
/// \param selector Socket selector to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API void sfSocketSelector_destroy(sfSocketSelector* selector);
|
||||
CSFML_NETWORK_API void sfSocketSelector_destroy(const sfSocketSelector* selector);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Add a new socket to a socket selector
|
||||
@@ -81,7 +81,7 @@ CSFML_NETWORK_API void sfSocketSelector_addUdpSocket(sfSocketSelector* selector,
|
||||
/// removes the pointer that the selector has to it.
|
||||
///
|
||||
/// \param selector Socket selector object
|
||||
/// \param socket POointer to the socket to remove
|
||||
/// \param socket Pointer to the socket to remove
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API void sfSocketSelector_removeTcpListener(sfSocketSelector* selector, sfTcpListener* socket);
|
||||
@@ -107,35 +107,32 @@ CSFML_NETWORK_API void sfSocketSelector_clear(sfSocketSelector* selector);
|
||||
/// some data available to be received. To know which sockets are
|
||||
/// ready, use the sfSocketSelector_isXxxReady functions.
|
||||
/// If you use a timeout and no socket is ready before the timeout
|
||||
/// is over, the function returns sfFalse.
|
||||
/// is over, the function returns false.
|
||||
///
|
||||
/// \param selector Socket selector object
|
||||
/// \param timeout Maximum time to wait (use sfTimeZero for infinity)
|
||||
///
|
||||
/// \return sfTrue if there are sockets ready, sfFalse otherwise
|
||||
/// \return true if there are sockets ready, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfBool sfSocketSelector_wait(sfSocketSelector* selector, sfTime timeout);
|
||||
CSFML_NETWORK_API bool sfSocketSelector_wait(sfSocketSelector* selector, sfTime timeout);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Test a socket to know if it is ready to receive data
|
||||
///
|
||||
/// This function must be used after a call to
|
||||
/// sfSocketSelector_Wait, to know which sockets are ready to
|
||||
/// sfSocketSelector_wait, to know which sockets are ready to
|
||||
/// receive data. If a socket is ready, a call to Receive will
|
||||
/// never block because we know that there is data available to read.
|
||||
/// Note that if this function returns sfTrue for a sfTcpListener,
|
||||
/// Note that if this function returns true for a sfTcpListener,
|
||||
/// this means that it is ready to accept a new connection.
|
||||
///
|
||||
/// \param selector Socket selector object
|
||||
/// \param socket Socket to test
|
||||
///
|
||||
/// \return sfTrue if the socket is ready to read, sfFalse otherwise
|
||||
/// \return true if the socket is ready to read, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfBool sfSocketSelector_isTcpListenerReady(const sfSocketSelector* selector, sfTcpListener* socket);
|
||||
CSFML_NETWORK_API sfBool sfSocketSelector_isTcpSocketReady(const sfSocketSelector* selector, sfTcpSocket* socket);
|
||||
CSFML_NETWORK_API sfBool sfSocketSelector_isUdpSocketReady(const sfSocketSelector* selector, sfUdpSocket* socket);
|
||||
|
||||
|
||||
#endif // SFML_SOCKETSELECTOR_H
|
||||
CSFML_NETWORK_API bool sfSocketSelector_isTcpListenerReady(const sfSocketSelector* selector, sfTcpListener* socket);
|
||||
CSFML_NETWORK_API bool sfSocketSelector_isTcpSocketReady(const sfSocketSelector* selector, sfTcpSocket* socket);
|
||||
CSFML_NETWORK_API bool sfSocketSelector_isUdpSocketReady(const sfSocketSelector* selector, sfUdpSocket* socket);
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,9 +22,7 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SOCKETSTATUS_H
|
||||
#define SFML_SOCKETSTATUS_H
|
||||
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Define the status that can be returned by the socket functions
|
||||
@@ -34,10 +32,7 @@ typedef enum
|
||||
{
|
||||
sfSocketDone, ///< The socket has sent / received the data
|
||||
sfSocketNotReady, ///< The socket is not ready to send / receive data yet
|
||||
sfSocketPartial, ///< The socket sent a part of the data
|
||||
sfSocketDisconnected, ///< The TCP socket has been disconnected
|
||||
sfSocketError ///< An unexpected error happened
|
||||
|
||||
} sfSocketStatus;
|
||||
|
||||
|
||||
#endif // SFML_SOCKETSTATUS_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,15 +22,16 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_TCPLISTENER_H
|
||||
#define SFML_TCPLISTENER_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Network/Export.h>
|
||||
#include <SFML/Network/SocketStatus.h>
|
||||
#include <SFML/Network/Types.h>
|
||||
#include <CSFML/Network/Export.h>
|
||||
|
||||
#include <CSFML/Network/IpAddress.h>
|
||||
#include <CSFML/Network/SocketStatus.h>
|
||||
#include <CSFML/Network/Types.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -47,14 +48,14 @@ CSFML_NETWORK_API sfTcpListener* sfTcpListener_create(void);
|
||||
/// \param listener TCP listener to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API void sfTcpListener_destroy(sfTcpListener* listener);
|
||||
CSFML_NETWORK_API void sfTcpListener_destroy(const sfTcpListener* listener);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the blocking state of a TCP listener
|
||||
///
|
||||
/// In blocking mode, calls will not return until they have
|
||||
/// completed their task. For example, a call to
|
||||
/// sfTcpListener_Accept in blocking mode won't return until
|
||||
/// sfTcpListener_accept in blocking mode won't return until
|
||||
/// a new connection was actually received.
|
||||
/// In non-blocking mode, calls will always return immediately,
|
||||
/// using the return code to signal whether there was data
|
||||
@@ -62,20 +63,20 @@ CSFML_NETWORK_API void sfTcpListener_destroy(sfTcpListener* listener);
|
||||
/// By default, all sockets are blocking.
|
||||
///
|
||||
/// \param listener TCP listener object
|
||||
/// \param blocking sfTrue to set the socket as blocking, sfFalse for non-blocking
|
||||
/// \param blocking true to set the socket as blocking, false for non-blocking
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API void sfTcpListener_setBlocking(sfTcpListener* listener, sfBool blocking);
|
||||
CSFML_NETWORK_API void sfTcpListener_setBlocking(sfTcpListener* listener, bool blocking);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether a TCP listener is in blocking or non-blocking mode
|
||||
///
|
||||
/// \param listener TCP listener object
|
||||
///
|
||||
/// \return sfTrue if the socket is blocking, sfFalse otherwise
|
||||
/// \return true if the socket is blocking, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfBool sfTcpListener_isBlocking(const sfTcpListener* listener);
|
||||
CSFML_NETWORK_API bool sfTcpListener_isBlocking(const sfTcpListener* listener);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the port to which a TCP listener is bound locally
|
||||
@@ -98,13 +99,16 @@ CSFML_NETWORK_API unsigned short sfTcpListener_getLocalPort(const sfTcpListener*
|
||||
/// If the socket was previously listening to another port,
|
||||
/// it will be stopped first and bound to the new port.
|
||||
///
|
||||
/// If there is no specific address to listen to, pass sfIpAddress_Any
|
||||
///
|
||||
/// \param listener TCP listener object
|
||||
/// \param port Port to listen for new connections
|
||||
/// \param address Address of the interface to listen on
|
||||
///
|
||||
/// \return Status code
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfSocketStatus sfTcpListener_listen(sfTcpListener* listener, unsigned short port);
|
||||
CSFML_NETWORK_API sfSocketStatus sfTcpListener_listen(sfTcpListener* listener, unsigned short port, sfIpAddress address);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Accept a new connection
|
||||
@@ -112,6 +116,10 @@ CSFML_NETWORK_API sfSocketStatus sfTcpListener_listen(sfTcpListener* listener, u
|
||||
/// If the socket is in blocking mode, this function will
|
||||
/// not return until a connection is actually received.
|
||||
///
|
||||
/// The \a connected argument points to a valid sfTcpSocket pointer
|
||||
/// in case of success (the function returns sfSocketDone), it points
|
||||
/// to a NULL pointer otherwise.
|
||||
///
|
||||
/// \param listener TCP listener object
|
||||
/// \param connected Socket that will hold the new connection
|
||||
///
|
||||
@@ -119,6 +127,3 @@ CSFML_NETWORK_API sfSocketStatus sfTcpListener_listen(sfTcpListener* listener, u
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfSocketStatus sfTcpListener_accept(sfTcpListener* listener, sfTcpSocket** connected);
|
||||
|
||||
|
||||
#endif // SFML_TCPLISTENER_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,17 +22,18 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_TCPSOCKET_H
|
||||
#define SFML_TCPSOCKET_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Network/Export.h>
|
||||
#include <SFML/Network/IpAddress.h>
|
||||
#include <SFML/Network/SocketStatus.h>
|
||||
#include <SFML/Network/Types.h>
|
||||
#include <SFML/System/Time.h>
|
||||
#include <CSFML/Network/Export.h>
|
||||
|
||||
#include <CSFML/Network/IpAddress.h>
|
||||
#include <CSFML/Network/SocketStatus.h>
|
||||
#include <CSFML/Network/Types.h>
|
||||
#include <CSFML/System/Time.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
@@ -50,7 +51,7 @@ CSFML_NETWORK_API sfTcpSocket* sfTcpSocket_create(void);
|
||||
/// \param socket TCP socket to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API void sfTcpSocket_destroy(sfTcpSocket* socket);
|
||||
CSFML_NETWORK_API void sfTcpSocket_destroy(const sfTcpSocket* socket);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the blocking state of a TCP listener
|
||||
@@ -65,20 +66,20 @@ CSFML_NETWORK_API void sfTcpSocket_destroy(sfTcpSocket* socket);
|
||||
/// By default, all sockets are blocking.
|
||||
///
|
||||
/// \param socket TCP socket object
|
||||
/// \param blocking sfTrue to set the socket as blocking, sfFalse for non-blocking
|
||||
/// \param blocking true to set the socket as blocking, false for non-blocking
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API void sfTcpSocket_setBlocking(sfTcpSocket* socket, sfBool blocking);
|
||||
CSFML_NETWORK_API void sfTcpSocket_setBlocking(sfTcpSocket* socket, bool blocking);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether a TCP socket is in blocking or non-blocking mode
|
||||
///
|
||||
/// \param socket TCP socket object
|
||||
///
|
||||
/// \return sfTrue if the socket is blocking, sfFalse otherwise
|
||||
/// \return true if the socket is blocking, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfBool sfTcpSocket_isBlocking(const sfTcpSocket* socket);
|
||||
CSFML_NETWORK_API bool sfTcpSocket_isBlocking(const sfTcpSocket* socket);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the port to which a TCP socket is bound locally
|
||||
@@ -95,7 +96,7 @@ CSFML_NETWORK_API unsigned short sfTcpSocket_getLocalPort(const sfTcpSocket* soc
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the address of the connected peer of a TCP socket
|
||||
///
|
||||
/// It the socket is not connected, this function returns
|
||||
/// If the socket is not connected, this function returns
|
||||
/// sfIpAddress_None.
|
||||
///
|
||||
/// \param socket TCP socket object
|
||||
@@ -134,7 +135,8 @@ CSFML_NETWORK_API unsigned short sfTcpSocket_getRemotePort(const sfTcpSocket* so
|
||||
/// \return Status code
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfSocketStatus sfTcpSocket_connect(sfTcpSocket* socket, sfIpAddress host, unsigned short port, sfTime timeout);
|
||||
CSFML_NETWORK_API sfSocketStatus
|
||||
sfTcpSocket_connect(sfTcpSocket* socket, sfIpAddress remoteAddress, unsigned short remotePort, sfTime timeout);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Disconnect a TCP socket from its remote peer
|
||||
@@ -150,6 +152,9 @@ CSFML_NETWORK_API void sfTcpSocket_disconnect(sfTcpSocket* socket);
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Send raw data to the remote peer of a TCP socket
|
||||
///
|
||||
/// To be able to handle partial sends over non-blocking
|
||||
/// sockets, use the sfTcpSocket_sendPartial(sfTcpSocket*, const void*, size_t, size_t*)
|
||||
/// overload instead.
|
||||
/// This function will fail if the socket is not connected.
|
||||
///
|
||||
/// \param socket TCP socket object
|
||||
@@ -161,6 +166,21 @@ CSFML_NETWORK_API void sfTcpSocket_disconnect(sfTcpSocket* socket);
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfSocketStatus sfTcpSocket_send(sfTcpSocket* socket, const void* data, size_t size);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Send raw data to the remote peer
|
||||
///
|
||||
/// This function will fail if the socket is not connected.
|
||||
///
|
||||
/// \param socket TCP socket object
|
||||
/// \param data Pointer to the sequence of bytes to send
|
||||
/// \param size Number of bytes to send
|
||||
/// \param sent The number of bytes sent will be written here
|
||||
///
|
||||
/// \return Status code
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfSocketStatus sfTcpSocket_sendPartial(sfTcpSocket* socket, const void* data, size_t size, size_t* sent);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Receive raw data from the remote peer of a TCP socket
|
||||
///
|
||||
@@ -176,11 +196,15 @@ CSFML_NETWORK_API sfSocketStatus sfTcpSocket_send(sfTcpSocket* socket, const voi
|
||||
/// \return Status code
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfSocketStatus sfTcpSocket_receive(sfTcpSocket* socket, void* data, size_t maxSize, size_t* sizeReceived);
|
||||
CSFML_NETWORK_API sfSocketStatus sfTcpSocket_receive(sfTcpSocket* socket, void* data, size_t size, size_t* received);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Send a formatted packet of data to the remote peer of a TCP socket
|
||||
///
|
||||
/// In non-blocking mode, if this function returns sfSocketPartial,
|
||||
/// you must retry sending the same unmodified packet before sending
|
||||
/// anything else in order to guarantee the packet arrives at the remote
|
||||
/// peer uncorrupted.
|
||||
/// This function will fail if the socket is not connected.
|
||||
///
|
||||
/// \param socket TCP socket object
|
||||
@@ -205,6 +229,3 @@ CSFML_NETWORK_API sfSocketStatus sfTcpSocket_sendPacket(sfTcpSocket* socket, sfP
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfSocketStatus sfTcpSocket_receivePacket(sfTcpSocket* socket, sfPacket* packet);
|
||||
|
||||
|
||||
#endif // SFML_TCPSOCKET_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,22 +22,18 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_NETWORK_TYPES_H
|
||||
#define SFML_NETWORK_TYPES_H
|
||||
#pragma once
|
||||
|
||||
|
||||
typedef struct sfFtpDirectoryResponse sfFtpDirectoryResponse;
|
||||
typedef struct sfFtpListingResponse sfFtpListingResponse;
|
||||
typedef struct sfFtpResponse sfFtpResponse;
|
||||
typedef struct sfFtp sfFtp;
|
||||
typedef struct sfHttpRequest sfHttpRequest;
|
||||
typedef struct sfHttpResponse sfHttpResponse;
|
||||
typedef struct sfHttp sfHttp;
|
||||
typedef struct sfPacket sfPacket;
|
||||
typedef struct sfSocketSelector sfSocketSelector;
|
||||
typedef struct sfTcpListener sfTcpListener;
|
||||
typedef struct sfTcpSocket sfTcpSocket;
|
||||
typedef struct sfUdpSocket sfUdpSocket;
|
||||
|
||||
|
||||
#endif // SFML_NETWORK_TYPES_H
|
||||
typedef struct sfFtpListingResponse sfFtpListingResponse;
|
||||
typedef struct sfFtpResponse sfFtpResponse;
|
||||
typedef struct sfFtp sfFtp;
|
||||
typedef struct sfHttpRequest sfHttpRequest;
|
||||
typedef struct sfHttpResponse sfHttpResponse;
|
||||
typedef struct sfHttp sfHttp;
|
||||
typedef struct sfPacket sfPacket;
|
||||
typedef struct sfSocketSelector sfSocketSelector;
|
||||
typedef struct sfTcpListener sfTcpListener;
|
||||
typedef struct sfTcpSocket sfTcpSocket;
|
||||
typedef struct sfUdpSocket sfUdpSocket;
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,16 +22,17 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_UDPSOCKET_H
|
||||
#define SFML_UDPSOCKET_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Network/Export.h>
|
||||
#include <SFML/Network/IpAddress.h>
|
||||
#include <SFML/Network/SocketStatus.h>
|
||||
#include <SFML/Network/Types.h>
|
||||
#include <CSFML/Network/Export.h>
|
||||
|
||||
#include <CSFML/Network/IpAddress.h>
|
||||
#include <CSFML/Network/SocketStatus.h>
|
||||
#include <CSFML/Network/Types.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
@@ -49,7 +50,7 @@ CSFML_NETWORK_API sfUdpSocket* sfUdpSocket_create(void);
|
||||
/// \param socket UDP socket to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API void sfUdpSocket_destroy(sfUdpSocket* socket);
|
||||
CSFML_NETWORK_API void sfUdpSocket_destroy(const sfUdpSocket* socket);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the blocking state of a UDP listener
|
||||
@@ -64,20 +65,20 @@ CSFML_NETWORK_API void sfUdpSocket_destroy(sfUdpSocket* socket);
|
||||
/// By default, all sockets are blocking.
|
||||
///
|
||||
/// \param socket UDP socket object
|
||||
/// \param blocking sfTrue to set the socket as blocking, sfFalse for non-blocking
|
||||
/// \param blocking true to set the socket as blocking, false for non-blocking
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API void sfUdpSocket_setBlocking(sfUdpSocket* socket, sfBool blocking);
|
||||
CSFML_NETWORK_API void sfUdpSocket_setBlocking(sfUdpSocket* socket, bool blocking);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether a UDP socket is in blocking or non-blocking mode
|
||||
///
|
||||
/// \param socket UDP socket object
|
||||
///
|
||||
/// \return sfTrue if the socket is blocking, sfFalse otherwise
|
||||
/// \return true if the socket is blocking, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfBool sfUdpSocket_isBlocking(const sfUdpSocket* socket);
|
||||
CSFML_NETWORK_API bool sfUdpSocket_isBlocking(const sfUdpSocket* socket);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the port to which a UDP socket is bound locally
|
||||
@@ -101,13 +102,16 @@ CSFML_NETWORK_API unsigned short sfUdpSocket_getLocalPort(const sfUdpSocket* soc
|
||||
/// system to automatically pick an available port, and then
|
||||
/// call sfUdpSocket_getLocalPort to retrieve the chosen port.
|
||||
///
|
||||
/// \param socket UDP socket object
|
||||
/// \param port Port to bind the socket to
|
||||
/// If there is no specific address to listen to, pass sfIpAddress_Any
|
||||
///
|
||||
/// \param socket UDP socket object
|
||||
/// \param port Port to bind the socket to
|
||||
/// \param address Address of the interface to bind to
|
||||
///
|
||||
/// \return Status code
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfSocketStatus sfUdpSocket_bind(sfUdpSocket* socket, unsigned short port);
|
||||
CSFML_NETWORK_API sfSocketStatus sfUdpSocket_bind(sfUdpSocket* socket, unsigned short port, sfIpAddress address);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Unbind a UDP socket from the local port to which it is bound
|
||||
@@ -119,7 +123,7 @@ CSFML_NETWORK_API sfSocketStatus sfUdpSocket_bind(sfUdpSocket* socket, unsigned
|
||||
/// \param socket UDP socket object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API void sfUdpSocket_Unbind(sfUdpSocket* socket);
|
||||
CSFML_NETWORK_API void sfUdpSocket_unbind(sfUdpSocket* socket);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Send raw data to a remote peer with a UDP socket
|
||||
@@ -137,7 +141,8 @@ CSFML_NETWORK_API void sfUdpSocket_Unbind(sfUdpSocket* socket);
|
||||
/// \return Status code
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfSocketStatus sfUdpSocket_send(sfUdpSocket* socket, const void* data, size_t size, sfIpAddress address, unsigned short port);
|
||||
CSFML_NETWORK_API sfSocketStatus
|
||||
sfUdpSocket_send(sfUdpSocket* socket, const void* data, size_t size, sfIpAddress remoteAddress, unsigned short remotePort);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Receive raw data from a remote peer with a UDP socket
|
||||
@@ -159,7 +164,13 @@ CSFML_NETWORK_API sfSocketStatus sfUdpSocket_send(sfUdpSocket* socket, const voi
|
||||
/// \return Status code
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfSocketStatus sfUdpSocket_receive(sfUdpSocket* socket, void* data, size_t maxSize, size_t* sizeReceived, sfIpAddress* address, unsigned short* port);
|
||||
CSFML_NETWORK_API sfSocketStatus sfUdpSocket_receive(
|
||||
sfUdpSocket* socket,
|
||||
void* data,
|
||||
size_t size,
|
||||
size_t* received,
|
||||
sfIpAddress* remoteAddress,
|
||||
unsigned short* remotePort);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Send a formatted packet of data to a remote peer with a UDP socket
|
||||
@@ -176,7 +187,8 @@ CSFML_NETWORK_API sfSocketStatus sfUdpSocket_receive(sfUdpSocket* socket, void*
|
||||
/// \return Status code
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfSocketStatus sfUdpSocket_sendPacket(sfUdpSocket* socket, sfPacket* packet, sfIpAddress address, unsigned short port);
|
||||
CSFML_NETWORK_API sfSocketStatus
|
||||
sfUdpSocket_sendPacket(sfUdpSocket* socket, sfPacket* packet, sfIpAddress remoteAddress, unsigned short remotePort);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Receive a formatted packet of data from a remote peer with a UDP socket
|
||||
@@ -184,6 +196,7 @@ CSFML_NETWORK_API sfSocketStatus sfUdpSocket_sendPacket(sfUdpSocket* socket, sfP
|
||||
/// In blocking mode, this function will wait until the whole packet
|
||||
/// has been received.
|
||||
///
|
||||
/// \param socket UDP socket object
|
||||
/// \param packet Packet to fill with the received data
|
||||
/// \param remoteAddress Address of the peer that sent the data
|
||||
/// \param remotePort Port of the peer that sent the data
|
||||
@@ -191,7 +204,8 @@ CSFML_NETWORK_API sfSocketStatus sfUdpSocket_sendPacket(sfUdpSocket* socket, sfP
|
||||
/// \return Status code
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfSocketStatus sfUdpSocket_receivePacket(sfUdpSocket* socket, sfPacket* packet, sfIpAddress* address, unsigned short* port);
|
||||
CSFML_NETWORK_API sfSocketStatus
|
||||
sfUdpSocket_receivePacket(sfUdpSocket* socket, sfPacket* packet, sfIpAddress* remoteAddress, unsigned short* remotePort);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return the maximum number of bytes that can be
|
||||
@@ -200,7 +214,4 @@ CSFML_NETWORK_API sfSocketStatus sfUdpSocket_receivePacket(sfUdpSocket* socket,
|
||||
/// \return The maximum size of a UDP datagram (message)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API unsigned int sfUdpSocket_maxDatagramSize();
|
||||
|
||||
|
||||
#endif // SFML_UDPSOCKET_H
|
||||
CSFML_NETWORK_API unsigned int sfUdpSocket_maxDatagramSize(void);
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,37 +22,32 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_OPENGL_H
|
||||
#define SFML_OPENGL_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <CSFML/Config.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// This file just includes the OpenGL (GL and GLU) headers,
|
||||
/// which have actually different paths on each system
|
||||
// This file just includes the OpenGL (GL and GLU) headers,
|
||||
// which have actually different paths on each system
|
||||
////////////////////////////////////////////////////////////
|
||||
#if defined(CSFML_SYSTEM_WINDOWS)
|
||||
|
||||
#include <windows.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <windows.h>
|
||||
|
||||
#elif defined(CSFML_SYSTEM_LINUX) || defined(CSFML_SYSTEM_FREEBSD)
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
#elif defined(CSFML_SYSTEM_MACOS)
|
||||
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glu.h>
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glu.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif // SFML_OPENGL_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,21 +22,18 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SYSTEM_H
|
||||
#define SFML_SYSTEM_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/System/Clock.h>
|
||||
#include <SFML/System/InputStream.h>
|
||||
#include <SFML/System/Mutex.h>
|
||||
#include <SFML/System/Sleep.h>
|
||||
#include <SFML/System/Thread.h>
|
||||
#include <SFML/System/Vector2.h>
|
||||
#include <SFML/System/Vector3.h>
|
||||
#include <CSFML/Config.h>
|
||||
|
||||
|
||||
#endif // SFML_SYSTEM_H
|
||||
#include <CSFML/System/Buffer.h>
|
||||
#include <CSFML/System/Clock.h>
|
||||
#include <CSFML/System/InputStream.h>
|
||||
#include <CSFML/System/Sleep.h>
|
||||
#include <CSFML/System/Time.h>
|
||||
#include <CSFML/System/Vector2.h>
|
||||
#include <CSFML/System/Vector3.h>
|
||||
@@ -0,0 +1,45 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <CSFML/System/Export.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Deallocates memory
|
||||
///
|
||||
/// This function deallocates the memory being pointed to
|
||||
/// using the free function from the C standard library.
|
||||
///
|
||||
/// The memory must have been previously allocated using a call
|
||||
/// to malloc.
|
||||
///
|
||||
/// \param ptr Pointer to the memory to deallocate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_SYSTEM_API void sfFree(void* ptr);
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,42 +22,50 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_CONTEXT_H
|
||||
#define SFML_CONTEXT_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Window/Export.h>
|
||||
#include <SFML/Window/Types.h>
|
||||
#include <CSFML/System/Export.h>
|
||||
|
||||
#include <CSFML/System/Types.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new context
|
||||
/// \brief Create an empty buffer
|
||||
///
|
||||
/// This function activates the new context.
|
||||
///
|
||||
/// \return New sfContext object
|
||||
/// \return A new sfBuffer object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API sfContext* sfContext_create(void);
|
||||
CSFML_SYSTEM_API sfBuffer* sfBuffer_create(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destroy a context
|
||||
/// \brief Destroy an existing buffer
|
||||
///
|
||||
/// \param context Context to destroy
|
||||
/// \param buffer Buffer to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API void sfContext_destroy(sfContext* context);
|
||||
CSFML_SYSTEM_API void sfBuffer_destroy(const sfBuffer* buffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Activate or deactivate explicitely a context
|
||||
/// \brief Return the size of a buffer
|
||||
///
|
||||
/// \param context Context object
|
||||
/// \param active sfTrue to activate, sfFalse to deactivate
|
||||
/// \param buffer Buffer object
|
||||
///
|
||||
/// \return Size in bytes
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API void sfContext_setActive(sfContext* context, sfBool active);
|
||||
CSFML_SYSTEM_API size_t sfBuffer_getSize(const sfBuffer* buffer);
|
||||
|
||||
|
||||
#endif // SFML_CONTEXT_H
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get a read-only pointer to the array of bytes of a buffer
|
||||
///
|
||||
/// \param buffer Buffer object
|
||||
///
|
||||
/// \return Read-only pointer to the array of bytes
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_SYSTEM_API const uint8_t* sfBuffer_getData(const sfBuffer* buffer);
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,15 +22,15 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_CLOCK_H
|
||||
#define SFML_CLOCK_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/System/Export.h>
|
||||
#include <SFML/System/Time.h>
|
||||
#include <SFML/System/Types.h>
|
||||
#include <CSFML/System/Export.h>
|
||||
|
||||
#include <CSFML/System/Time.h>
|
||||
#include <CSFML/System/Types.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -49,7 +49,7 @@ CSFML_SYSTEM_API sfClock* sfClock_create(void);
|
||||
/// \return A new sfClock object which is a copy of \a clock
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_SYSTEM_API sfClock* sfClock_copy(sfClock* clock);
|
||||
CSFML_SYSTEM_API sfClock* sfClock_copy(const sfClock* clock);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destroy a clock
|
||||
@@ -57,7 +57,7 @@ CSFML_SYSTEM_API sfClock* sfClock_copy(sfClock* clock);
|
||||
/// \param clock Clock to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_SYSTEM_API void sfClock_destroy(sfClock* clock);
|
||||
CSFML_SYSTEM_API void sfClock_destroy(const sfClock* clock);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the time elapsed in a clock
|
||||
@@ -73,6 +73,36 @@ CSFML_SYSTEM_API void sfClock_destroy(sfClock* clock);
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_SYSTEM_API sfTime sfClock_getElapsedTime(const sfClock* clock);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check whether the clock is running
|
||||
///
|
||||
/// \param clock Clock object
|
||||
///
|
||||
/// \return `true` if the clock is running, `false` otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_SYSTEM_API bool sfClock_isRunning(const sfClock* clock);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Start the clock
|
||||
///
|
||||
/// \param clock Clock object
|
||||
///
|
||||
/// \see `stop`
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_SYSTEM_API void sfClock_start(sfClock* clock);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Stop the clock
|
||||
///
|
||||
/// \param clock Clock object
|
||||
///
|
||||
/// \see `start`
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_SYSTEM_API void sfClock_stop(sfClock* clock);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Restart a clock
|
||||
///
|
||||
@@ -86,5 +116,17 @@ CSFML_SYSTEM_API sfTime sfClock_getElapsedTime(const sfClock* clock);
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_SYSTEM_API sfTime sfClock_restart(sfClock* clock);
|
||||
|
||||
|
||||
#endif // SFML_CLOCK_H
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Reset the clock
|
||||
///
|
||||
/// This function puts the time counter back to zero, returns
|
||||
/// the elapsed time, and leaves the clock in a paused state.
|
||||
///
|
||||
/// \param clock Clock object
|
||||
///
|
||||
/// \return Time elapsed
|
||||
///
|
||||
/// \see `restart`
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_SYSTEM_API sfTime sfClock_reset(sfClock* clock);
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,13 +22,12 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SYSTEM_EXPORT_H
|
||||
#define SFML_SYSTEM_EXPORT_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <CSFML/Config.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -36,13 +35,10 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
#if defined(CSFML_SYSTEM_EXPORTS)
|
||||
|
||||
#define CSFML_SYSTEM_API CSFML_API_EXPORT
|
||||
#define CSFML_SYSTEM_API CSFML_API_EXPORT
|
||||
|
||||
#else
|
||||
|
||||
#define CSFML_SYSTEM_API CSFML_API_IMPORT
|
||||
#define CSFML_SYSTEM_API CSFML_API_IMPORT
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif // SFML_SYSTEM_EXPORT_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,19 +22,20 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_INPUTSTREAM_H
|
||||
#define SFML_INPUTSTREAM_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/System/Export.h>
|
||||
#include <CSFML/System/Export.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
typedef sfInt64 (*sfInputStreamReadFunc)(void* data, sfInt64 size, void* userData);
|
||||
typedef sfInt64 (*sfInputStreamSeekFunc)(sfInt64 position, void* userData);
|
||||
typedef sfInt64 (*sfInputStreamTellFunc)(void* userData);
|
||||
typedef sfInt64 (*sfInputStreamGetSizeFunc)(void* userData);
|
||||
typedef int64_t (*sfInputStreamReadFunc)(void* data, size_t size, void* userData);
|
||||
typedef int64_t (*sfInputStreamSeekFunc)(size_t position, void* userData);
|
||||
typedef int64_t (*sfInputStreamTellFunc)(void* userData);
|
||||
typedef int64_t (*sfInputStreamGetSizeFunc)(void* userData);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -49,6 +50,3 @@ typedef struct sfInputStream
|
||||
sfInputStreamGetSizeFunc getSize; ///< Function to get the total number of bytes in the stream
|
||||
void* userData; ///< User data that will be passed to the callbacks
|
||||
} sfInputStream;
|
||||
|
||||
|
||||
#endif // SFML_INPUTSTREAM_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,14 +22,14 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SLEEP_H
|
||||
#define SFML_SLEEP_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/System/Export.h>
|
||||
#include <SFML/System/Time.h>
|
||||
#include <CSFML/System/Export.h>
|
||||
|
||||
#include <CSFML/System/Time.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -42,6 +42,3 @@
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_SYSTEM_API void sfSleep(sfTime duration);
|
||||
|
||||
|
||||
#endif // SFML_SLEEP_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,13 +22,12 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_TIME_H
|
||||
#define SFML_TIME_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/System/Export.h>
|
||||
#include <CSFML/System/Export.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -37,14 +36,14 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
sfInt64 microseconds;
|
||||
int64_t microseconds;
|
||||
} sfTime;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Predefined "zero" time value
|
||||
/// \brief Predefined "zero" time value
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_SYSTEM_API sfTime sfTime_Zero;
|
||||
CSFML_SYSTEM_API const sfTime sfTime_Zero;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return a time value as a number of seconds
|
||||
@@ -64,7 +63,7 @@ CSFML_SYSTEM_API float sfTime_asSeconds(sfTime time);
|
||||
/// \return Time in milliseconds
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_SYSTEM_API sfInt32 sfTime_asMilliseconds(sfTime time);
|
||||
CSFML_SYSTEM_API int32_t sfTime_asMilliseconds(sfTime time);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return a time value as a number of microseconds
|
||||
@@ -74,7 +73,7 @@ CSFML_SYSTEM_API sfInt32 sfTime_asMilliseconds(sfTime time);
|
||||
/// \return Time in microseconds
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_SYSTEM_API sfInt64 sfTime_asMicroseconds(sfTime time);
|
||||
CSFML_SYSTEM_API int64_t sfTime_asMicroseconds(sfTime time);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Construct a time value from a number of seconds
|
||||
@@ -94,7 +93,7 @@ CSFML_SYSTEM_API sfTime sfSeconds(float amount);
|
||||
/// \return Time value constructed from the amount of milliseconds
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_SYSTEM_API sfTime sfMilliseconds(sfInt32 amount);
|
||||
CSFML_SYSTEM_API sfTime sfMilliseconds(int32_t amount);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Construct a time value from a number of microseconds
|
||||
@@ -104,7 +103,4 @@ CSFML_SYSTEM_API sfTime sfMilliseconds(sfInt32 amount);
|
||||
/// \return Time value constructed from the amount of microseconds
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_SYSTEM_API sfTime sfMicroseconds(sfInt64 amount);
|
||||
|
||||
|
||||
#endif // SFML_TIME_H
|
||||
CSFML_SYSTEM_API sfTime sfMicroseconds(int64_t amount);
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,12 +22,8 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_WINDOW_TYPES_H
|
||||
#define SFML_WINDOW_TYPES_H
|
||||
#pragma once
|
||||
|
||||
|
||||
typedef struct sfContext sfContext;
|
||||
typedef struct sfWindow sfWindow;
|
||||
|
||||
|
||||
#endif // SFML_WINDOW_TYPES_H
|
||||
typedef struct sfBuffer sfBuffer;
|
||||
typedef struct sfClock sfClock;
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,13 +22,12 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_VECTOR2_H
|
||||
#define SFML_VECTOR2_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/System/Export.h>
|
||||
#include <CSFML/System/Export.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -62,6 +61,3 @@ typedef struct
|
||||
float x;
|
||||
float y;
|
||||
} sfVector2f;
|
||||
|
||||
|
||||
#endif // SFML_VECTOR2_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// 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.
|
||||
@@ -22,13 +22,12 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_VECTOR3_H
|
||||
#define SFML_VECTOR3_H
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/System/Export.h>
|
||||
#include <CSFML/System/Export.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -41,6 +40,3 @@ typedef struct
|
||||
float y;
|
||||
float z;
|
||||
} sfVector3f;
|
||||
|
||||
|
||||
#endif // SFML_VECTOR3_H
|
||||
Loaded 100 of 325 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user