Compare commits
449 Commits
Author | SHA1 | Date | |
---|---|---|---|
ed188b7303 | |||
1c4917fab4 | |||
d620c6f5b2 | |||
410d6bf919 | |||
570d7f17fb | |||
0b981f9b4d | |||
586134787c | |||
b737ab1350 | |||
d9af637050 | |||
f7e4d9848a | |||
d3a1dc40f5 | |||
56fd24ed80 | |||
ec8743417d | |||
f7c0c83ac2 | |||
b6798fa069 | |||
1271b9fa9a | |||
ddf06eb18e | |||
93f0ed44e8 | |||
2ff75a2969 | |||
5636205002 | |||
07ed5af300 | |||
f399f032e7 | |||
0626231b45 | |||
cbfb0b128c | |||
ce30d00385 | |||
fae31a2b28 | |||
14368abae7 | |||
6d7781b209 | |||
a0923acec7 | |||
64e81e04fd | |||
66337e0f6e | |||
17c36bb05e | |||
62d37d227d | |||
a9600f8d02 | |||
a1de7e9d13 | |||
8deb589399 | |||
f3291963d4 | |||
e0c03f2ec5 | |||
3fc38405de | |||
19450ba2c9 | |||
6f658af674 | |||
75f8b84794 | |||
e78ac834db | |||
a72ea0beb4 | |||
0397b07488 | |||
76a8b5ee5a | |||
04c56a98d5 | |||
6e8f3f0f8b | |||
ce7c59a162 | |||
0627fa71be | |||
3a77cd0687 | |||
0092edf54f | |||
968c2576b9 | |||
688570b3cd | |||
33bb37be06 | |||
168614d579 | |||
a671631dde | |||
566485ccd6 | |||
267f9ce5c3 | |||
5cca34ede4 | |||
5695110739 | |||
476bd93aa7 | |||
9a7078b067 | |||
44ef9f2aad | |||
1ef946570d | |||
ae8181a6e5 | |||
7c190e3cfa | |||
805512fbea | |||
780025bb74 | |||
f6e3c50814 | |||
0399808eb2 | |||
cd677cf3e8 | |||
67edfa4245 | |||
66a35f28e6 | |||
2f7a266dc5 | |||
8a0fd07275 | |||
89299bf91e | |||
af88277680 | |||
dd17a70551 | |||
ec0411373b | |||
222a13387d | |||
c1e471f23a | |||
6b48ba070c | |||
bbbfd60bb7 | |||
62fa5ede9d | |||
20c3a525c8 | |||
8b70d0e9b7 | |||
36e5676d9f | |||
f706193945 | |||
e24b704809 | |||
91bbcdb7a7 | |||
2cb54dd570 | |||
90dde05b79 | |||
1ae4ff72d3 | |||
9213a1d5dd | |||
ca52e6dae6 | |||
83946b1e66 | |||
61cb41ae29 | |||
bca1c36f75 | |||
3270842a1b | |||
bd7d21d489 | |||
cc5d669ab4 | |||
2c38997b4c | |||
a49bcd8712 | |||
dbaa4d912a | |||
8f2c877197 | |||
1ee4f6849e | |||
3d89e94823 | |||
228d0088fb | |||
86465b5f76 | |||
6af08275e9 | |||
3c7c12ef39 | |||
404761d712 | |||
83d948ef24 | |||
946deb210d | |||
c2cdf256ba | |||
f0f4a64dfc | |||
25ced38cba | |||
86166f87eb | |||
54cce27a34 | |||
4d6a24f51f | |||
2e6d2c3cd5 | |||
7f62666017 | |||
8b3173811a | |||
b40f6d738e | |||
d4f12cb9b0 | |||
690dd1d6ca | |||
c21e8192d4 | |||
d4878d4e3d | |||
0503fe7e5b | |||
cd20f32acb | |||
c0fe7eaab5 | |||
f1b712af4a | |||
3231bc8240 | |||
8f80a99fc6 | |||
2cc908b043 | |||
d07d2a246a | |||
bf51ecda77 | |||
d87235c4b5 | |||
6c22b58487 | |||
05835a5c07 | |||
fa948a7beb | |||
04741198e2 | |||
5fb7ca78a9 | |||
ce0d83912e | |||
26eb9b4970 | |||
02ea4c6b4b | |||
0d35167c90 | |||
51ab42a9b0 | |||
4ca9e96276 | |||
b71b359502 | |||
a75f37c2d4 | |||
a7a44b39dc | |||
f6eb34ed78 | |||
099f21345f | |||
c1876482f7 | |||
a70f243421 | |||
b100891c34 | |||
2f4e78b138 | |||
5163f19796 | |||
c3f737de14 | |||
809b0cfad6 | |||
cacf83d434 | |||
ca1e242997 | |||
165b3b347f | |||
2965c3945a | |||
8d28ae3754 | |||
7d327f22aa | |||
d0c2123996 | |||
6081c4d310 | |||
0dfb37cc1c | |||
f15e457947 | |||
5d3db56ee4 | |||
8bec3356e5 | |||
3b4e541d0e | |||
b03633e010 | |||
651a43574f | |||
8e7bee4ea2 | |||
db66485432 | |||
12d47e5482 | |||
39c1a0f991 | |||
3f548f2d09 | |||
6587d22d2c | |||
76da1a033f | |||
6c530c44bd | |||
85fa45201e | |||
10d4ad6fd5 | |||
d5a3da2c35 | |||
a8b0540ecc | |||
cc5579971d | |||
6123bd3307 | |||
ed0d9998ff | |||
483efd280a | |||
1e2b4c0476 | |||
3992096df3 | |||
7165d1edc4 | |||
27653c2350 | |||
67ecd0ceff | |||
de74aac8af | |||
e1e0d1cbd5 | |||
b6051242a2 | |||
ea778c004b | |||
b5dbe5ce78 | |||
7645b45992 | |||
c0bf1c7bf1 | |||
49805784b0 | |||
8b7b12007b | |||
88b329f1d0 | |||
5fbbae9f99 | |||
520eec7c9c | |||
f75078b42b | |||
16ef0ff65a | |||
fed723aa48 | |||
6813c50c12 | |||
3c18129f94 | |||
409161efe7 | |||
8e7958be76 | |||
9e5ce455ca | |||
94e90a3cd8 | |||
58b4667ec7 | |||
97aff8615a | |||
e57c15bddb | |||
82d8005529 | |||
acc0bdfd87 | |||
a7accb0bf5 | |||
c5c83a9c17 | |||
aed653f0c8 | |||
b5995e2f93 | |||
0977e0a80f | |||
54a9b80523 | |||
72adb90757 | |||
f2549997ba | |||
063a342ad5 | |||
20f7730448 | |||
aa5ca1a3f0 | |||
0dab5c6599 | |||
3f0f8f351c | |||
e150265bc4 | |||
6fd37ffd3d | |||
f7bd625610 | |||
20cec2442c | |||
dcf6d77979 | |||
0cfd1a0e42 | |||
303e4105cb | |||
8c8613aca6 | |||
ead304d698 | |||
edb634b79d | |||
d0e4d2296c | |||
078e0d0d8b | |||
855e312ad4 | |||
ffb313971d | |||
ef8e4a379c | |||
945038042a | |||
d59cf0f9e0 | |||
12d5b48632 | |||
489d4f54a1 | |||
80f53cb013 | |||
ab71f5c84f | |||
f3c8482c6d | |||
4bdc38b7d9 | |||
1f8c0fa06e | |||
4ec44b0f89 | |||
d82ec589bd | |||
51276fd171 | |||
1c5cd37a4f | |||
f3111623c1 | |||
4bacf86367 | |||
f1e6109fa5 | |||
fe2e9f0dcf | |||
9a2525e9e5 | |||
abef666256 | |||
d31f63a47e | |||
d4e4dbc565 | |||
b8cefcc12d | |||
ca4de52619 | |||
22b6f477ba | |||
fe13f3d6b4 | |||
c697ae9bd1 | |||
d22b7b718c | |||
61285be23e | |||
eb0ccc8b25 | |||
ca8db2564d | |||
c4a8c54da2 | |||
9d4f94dba2 | |||
4adf59193c | |||
7766b4071c | |||
3d0f3a3ab6 | |||
0e7ac54ef7 | |||
6c03dde215 | |||
aa6c96c9a3 | |||
28abaa62ff | |||
c8e65e39c3 | |||
4fe4232796 | |||
81fa120cb7 | |||
92fdc24a49 | |||
237c9108bf | |||
069cfba51b | |||
e4ef5b55fe | |||
a10e2aaab9 | |||
b35ed87573 | |||
ab867588d3 | |||
087b2a2bb0 | |||
c8fcce1de3 | |||
a5f3e60e3a | |||
fbc54e0065 | |||
1bbefb259a | |||
569e82f476 | |||
51822aef23 | |||
f0ae9c238c | |||
b9578e151d | |||
ad655021a4 | |||
9c66052878 | |||
d98707aa8f | |||
95dc698349 | |||
13916e3dff | |||
44f618e9d8 | |||
235c2c2d7e | |||
dfce1b2adb | |||
b68c7d29ae | |||
7737cba060 | |||
4cd82f2e25 | |||
a15b0bdb2d | |||
f7f0d26896 | |||
e73ee7c6db | |||
0d4cc6f30f | |||
d7c02bab33 | |||
4750ba5a6c | |||
8dabfd58ab | |||
16510f5261 | |||
60d85b2a5e | |||
69fe7d4cb4 | |||
0e772b1394 | |||
596d2a8611 | |||
f1f71b93e2 | |||
b0a74a0bf6 | |||
00ec77e6a3 | |||
d2145977c5 | |||
c733394277 | |||
43ea66236c | |||
0cd8eaa423 | |||
af296546ff | |||
26db113a09 | |||
e2ca5f27b6 | |||
ed2b2c4ed8 | |||
7c3e17e820 | |||
64045ebddf | |||
14800862be | |||
c640a2ec38 | |||
1a87a2519f | |||
52d7433385 | |||
03247039d3 | |||
9dc3feb1f3 | |||
a64f16e371 | |||
2327fcb284 | |||
0e56aa0905 | |||
d568126176 | |||
f11b74ba85 | |||
a4eac5221d | |||
31360d90f3 | |||
d3c1a8aaa6 | |||
e944cd8f55 | |||
5af0535d74 | |||
6548670e59 | |||
69f8a7fd51 | |||
8ba4bcdc1b | |||
0d104edab3 | |||
2c17269f84 | |||
8cf2c798e6 | |||
48cb6d4034 | |||
78b3ff7f68 | |||
e304bdf00f | |||
ad169b01cb | |||
dc7034db91 | |||
b01393cd33 | |||
54579d1f18 | |||
96dbdf3309 | |||
b690ea5822 | |||
fbe59355ce | |||
809ddbad47 | |||
9be2bb672a | |||
469896be32 | |||
6f8ec89373 | |||
4368d6d7ee | |||
3af5da9d3e | |||
560ee65932 | |||
e42d1ec20a | |||
bfa3b0a1c6 | |||
c2484c1892 | |||
fe15309b77 | |||
cadb23f9e2 | |||
c401c3f2e3 | |||
b2eccd5ebb | |||
48de80fe13 | |||
ba97c9ed70 | |||
e717a52491 | |||
006f16f32f | |||
184a97b2d7 | |||
b72caa1ba0 | |||
b81160bbd3 | |||
ae4212e5a6 | |||
6821dd2bca | |||
c5a3910ccf | |||
12ea3dc60f | |||
3d3f26bf57 | |||
66b8f6b921 | |||
cc5a011a89 | |||
83e0b11f8f | |||
165552b439 | |||
5eefebee43 | |||
762b08eb08 | |||
0032d26010 | |||
ee4fe4f131 | |||
5b926a7317 | |||
f0b02d64ef | |||
3e2af92e7e | |||
7384ba6f4f | |||
a1d9b4344a | |||
3fc36d5b14 | |||
87f9b915e2 | |||
fa1980d47c | |||
d80017fcb5 | |||
db27c91ec9 | |||
9036726e92 | |||
a0350b7814 | |||
0cd2f330ad | |||
9a5479d68b | |||
595828fe84 | |||
788d8f81a5 | |||
d8a6a9e45c | |||
113af5fabb | |||
c6b7099df2 | |||
db778f462a | |||
5d02c2c6f2 | |||
83eeee453e | |||
2d05d1e7a9 | |||
4d11cb9e91 | |||
cbbc4d54d9 | |||
22ae99f915 | |||
b7a544eadd | |||
328ff9d23b | |||
624b59db9d | |||
adf783c2a1 | |||
db89d5c60f | |||
9623606229 | |||
5200f27182 | |||
36f545855d | |||
c2b35fdf83 | |||
59fcc8c159 | |||
8431119ff5 |
259
.clang-format
Normal file
259
.clang-format
Normal file
@ -0,0 +1,259 @@
|
||||
---
|
||||
Language: Cpp
|
||||
# BasedOnStyle: Google
|
||||
AccessModifierOffset: -1
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignArrayOfStructures: None
|
||||
AlignConsecutiveAssignments:
|
||||
Enabled: false
|
||||
AcrossEmptyLines: false
|
||||
AcrossComments: false
|
||||
AlignCompound: false
|
||||
PadOperators: true
|
||||
AlignConsecutiveBitFields:
|
||||
Enabled: false
|
||||
AcrossEmptyLines: false
|
||||
AcrossComments: false
|
||||
AlignCompound: false
|
||||
PadOperators: false
|
||||
AlignConsecutiveDeclarations:
|
||||
Enabled: false
|
||||
AcrossEmptyLines: false
|
||||
AcrossComments: false
|
||||
AlignCompound: false
|
||||
PadOperators: false
|
||||
AlignConsecutiveMacros:
|
||||
Enabled: false
|
||||
AcrossEmptyLines: false
|
||||
AcrossComments: false
|
||||
AlignCompound: false
|
||||
PadOperators: false
|
||||
AlignEscapedNewlines: Left
|
||||
AlignOperands: Align
|
||||
AlignTrailingComments:
|
||||
Kind: Always
|
||||
OverEmptyLines: 0
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: Never
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortEnumsOnASingleLine: true
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
AllowShortIfStatementsOnASingleLine: WithoutElse
|
||||
AllowShortLambdasOnASingleLine: All
|
||||
AllowShortLoopsOnASingleLine: true
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
AlwaysBreakTemplateDeclarations: Yes
|
||||
AttributeMacros:
|
||||
- __capability
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BitFieldColonSpacing: Both
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: false
|
||||
AfterClass: false
|
||||
AfterControlStatement: Never
|
||||
AfterEnum: false
|
||||
AfterExternBlock: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
BeforeLambdaBody: false
|
||||
BeforeWhile: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakAfterAttributes: Never
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakArrays: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeConceptDeclarations: Always
|
||||
BreakBeforeBraces: Attach
|
||||
BreakBeforeInlineASMColon: OnlyMultiline
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakInheritanceList: BeforeColon
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 80
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DerivePointerAlignment: true
|
||||
DisableFormat: false
|
||||
EmptyLineAfterAccessModifier: Never
|
||||
EmptyLineBeforeAccessModifier: LogicalBlock
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: true
|
||||
ForEachMacros:
|
||||
- foreach
|
||||
- Q_FOREACH
|
||||
- BOOST_FOREACH
|
||||
IfMacros:
|
||||
- KJ_IF_MAYBE
|
||||
IncludeBlocks: Regroup
|
||||
IncludeCategories:
|
||||
- Regex: '^<ext/.*\.h>'
|
||||
Priority: 2
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
- Regex: '^<.*\.h>'
|
||||
Priority: 1
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
- Regex: '^<.*'
|
||||
Priority: 2
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
- Regex: '.*'
|
||||
Priority: 3
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
IncludeIsMainRegex: '([-_](test|unittest))?$'
|
||||
IncludeIsMainSourceRegex: ''
|
||||
IndentAccessModifiers: false
|
||||
IndentCaseBlocks: false
|
||||
IndentCaseLabels: true
|
||||
IndentExternBlock: AfterExternBlock
|
||||
IndentGotoLabels: true
|
||||
IndentPPDirectives: None
|
||||
IndentRequiresClause: true
|
||||
IndentWidth: 2
|
||||
IndentWrappedFunctionNames: false
|
||||
InsertBraces: false
|
||||
InsertNewlineAtEOF: false
|
||||
InsertTrailingCommas: None
|
||||
IntegerLiteralSeparator:
|
||||
Binary: 0
|
||||
BinaryMinDigits: 0
|
||||
Decimal: 0
|
||||
DecimalMinDigits: 0
|
||||
Hex: 0
|
||||
HexMinDigits: 0
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
LambdaBodyIndentation: Signature
|
||||
LineEnding: DeriveLF
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
ObjCBinPackProtocolList: Never
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCBreakBeforeNestedBlockParam: true
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PackConstructorInitializers: NextLine
|
||||
PenaltyBreakAssignment: 2
|
||||
PenaltyBreakBeforeFirstCallParameter: 1
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakOpenParenthesis: 0
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyBreakTemplateDeclaration: 10
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyIndentedWhitespace: 0
|
||||
PenaltyReturnTypeOnItsOwnLine: 200
|
||||
PointerAlignment: Left
|
||||
PPIndentWidth: -1
|
||||
QualifierAlignment: Leave
|
||||
RawStringFormats:
|
||||
- Language: Cpp
|
||||
Delimiters:
|
||||
- cc
|
||||
- CC
|
||||
- cpp
|
||||
- Cpp
|
||||
- CPP
|
||||
- 'c++'
|
||||
- 'C++'
|
||||
CanonicalDelimiter: ''
|
||||
BasedOnStyle: google
|
||||
- Language: TextProto
|
||||
Delimiters:
|
||||
- pb
|
||||
- PB
|
||||
- proto
|
||||
- PROTO
|
||||
EnclosingFunctions:
|
||||
- EqualsProto
|
||||
- EquivToProto
|
||||
- PARSE_PARTIAL_TEXT_PROTO
|
||||
- PARSE_TEST_PROTO
|
||||
- PARSE_TEXT_PROTO
|
||||
- ParseTextOrDie
|
||||
- ParseTextProtoOrDie
|
||||
- ParseTestProto
|
||||
- ParsePartialTestProto
|
||||
CanonicalDelimiter: pb
|
||||
BasedOnStyle: google
|
||||
ReferenceAlignment: Pointer
|
||||
ReflowComments: true
|
||||
RemoveBracesLLVM: false
|
||||
RemoveSemicolon: false
|
||||
RequiresClausePosition: OwnLine
|
||||
RequiresExpressionIndentation: OuterScope
|
||||
SeparateDefinitionBlocks: Leave
|
||||
ShortNamespaceLines: 1
|
||||
SortIncludes: CaseSensitive
|
||||
SortJavaStaticImport: Before
|
||||
SortUsingDeclarations: LexicographicNumeric
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceAroundPointerQualifiers: Default
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCaseColon: false
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeParensOptions:
|
||||
AfterControlStatements: true
|
||||
AfterForeachMacros: true
|
||||
AfterFunctionDefinitionName: false
|
||||
AfterFunctionDeclarationName: false
|
||||
AfterIfMacros: true
|
||||
AfterOverloadedOperator: false
|
||||
AfterRequiresInClause: false
|
||||
AfterRequiresInExpression: false
|
||||
BeforeNonEmptyParentheses: false
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceBeforeSquareBrackets: false
|
||||
SpaceInEmptyBlock: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 2
|
||||
SpacesInAngles: Never
|
||||
SpacesInConditionalStatement: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInLineCommentPrefix:
|
||||
Minimum: 1
|
||||
Maximum: -1
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Auto
|
||||
StatementAttributeLikeMacros:
|
||||
- Q_EMIT
|
||||
StatementMacros:
|
||||
- Q_UNUSED
|
||||
- QT_REQUIRE_VERSION
|
||||
TabWidth: 8
|
||||
UseTab: Never
|
||||
WhitespaceSensitiveMacros:
|
||||
- BOOST_PP_STRINGIZE
|
||||
- CF_SWIFT_NAME
|
||||
- NS_SWIFT_NAME
|
||||
- PP_STRINGIZE
|
||||
- STRINGIZE
|
||||
...
|
||||
|
32
.github/workflows/Docs.yml
vendored
32
.github/workflows/Docs.yml
vendored
@ -1,32 +0,0 @@
|
||||
name: 📄
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "**" ]
|
||||
pull_request:
|
||||
branches: [ "*" ]
|
||||
|
||||
jobs:
|
||||
# This workflow contains a single job called "build"
|
||||
build:
|
||||
# The type of runner that the job will run on
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||
steps:
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
# Runs a single command using the runners shell
|
||||
- name: Run a one-line script
|
||||
run: |
|
||||
cd ..
|
||||
git clone https://github.com/NPI-D7/BCSTM-Player.git
|
||||
cp -r BCSTM-Player/RenderD7-alpha0-6-0/* RenderD7/
|
||||
cd RenderD7
|
||||
git config --global user.email "tobid7@outlook.de"
|
||||
git config --global user.name "Tobi-D7"
|
||||
git stage *
|
||||
git commit -m "BCSTM-Player | $COMMIT_HASH"
|
||||
git tag v$CURRENT_DATE
|
||||
git push origin main v$CURRENT_DATE
|
11
.gitignore
vendored
Normal file
11
.gitignore
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
*.bz2
|
||||
*.DS_Store*
|
||||
.cache/
|
||||
compile_commands.json
|
||||
|
||||
# DOCS
|
||||
docs/*
|
||||
!docs/javascripts
|
||||
!docs/overrides
|
||||
!docs/stylesheets
|
||||
site/*
|
18
.vscode/c_cpp_properties.json
vendored
Normal file
18
.vscode/c_cpp_properties.json
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "3DS | Windows",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**",
|
||||
"C:/devkitpro/libctru/include/**",
|
||||
"C:/devkitpro/devkitARM/include/**",
|
||||
"C:/devkitpro/devkitARM/arm-none-eabi/include/**",
|
||||
"C:/devkitpro/portlibs/3ds/include/**",
|
||||
"/opt/devkitpro/libctru/include/**",
|
||||
"/opt/devkitpro/portlibs/**"
|
||||
|
||||
]
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
121
.vscode/launch.json
vendored
Normal file
121
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,121 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "(gdb) Launch",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/rd7tf/rd7tf.elf",
|
||||
"targetArchitecture": "arm",
|
||||
"serverLaunchTimeout": 10000,
|
||||
"stopAtEntry": true,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": true,
|
||||
"MIMode": "gdb",
|
||||
/// LINUX
|
||||
//"miDebuggerPath": "/opt/devkitPro/devkitARM/bin/arm-none-eabi-gdb",
|
||||
/// WINDOWS
|
||||
"miDebuggerPath": "C:/devkitPro/devkitARM/bin/arm-none-eabi-gdb.exe",
|
||||
"miDebuggerServerAddress": "192.168.2.220:4003",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing",
|
||||
"text": "file ${workspaceFolder}/rd7tf/rd7tf.elf -enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "(gdb-emu) Launch",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/rd7tf/rd7tf.elf",
|
||||
"targetArchitecture": "arm",
|
||||
"serverLaunchTimeout": 10000,
|
||||
"stopAtEntry": true,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": true,
|
||||
"MIMode": "gdb",
|
||||
/// LINUX
|
||||
//"miDebuggerPath": "/opt/devkitPro/devkitARM/bin/arm-none-eabi-gdb",
|
||||
/// WINDOWS
|
||||
"miDebuggerPath": "C:/devkitPro/devkitARM/bin/arm-none-eabi-gdb.exe",
|
||||
"miDebuggerServerAddress": "localhost:4003",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing",
|
||||
"text": "file ${workspaceFolder}/rd7tf/rd7tf.elf -enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "(gdb-emu) lua",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/rd7le/rd7le.elf",
|
||||
"targetArchitecture": "arm",
|
||||
"serverLaunchTimeout": 10000,
|
||||
"stopAtEntry": true,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": true,
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerPath": "C:\\devkitPro\\devkitARM\\bin\\arm-none-eabi-gdb.exe",
|
||||
"miDebuggerServerAddress": "localhost:4003",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing",
|
||||
"text": "file ${workspaceFolder}/rd7le/rd7le.elf -enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "(gdb) lua",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/rd7le/rd7le.elf",
|
||||
"targetArchitecture": "arm",
|
||||
"serverLaunchTimeout": 10000,
|
||||
"stopAtEntry": true,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": true,
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerPath": "C:\\devkitPro\\devkitARM\\bin\\arm-none-eabi-gdb.exe",
|
||||
"miDebuggerServerAddress": "192.168.2.220:4003",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing",
|
||||
"text": "file ${workspaceFolder}/rd7le/rd7le.elf -enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "(gdb) testgame",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/testgame/testgame.elf",
|
||||
"targetArchitecture": "arm",
|
||||
"serverLaunchTimeout": 10000,
|
||||
"stopAtEntry": true,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": true,
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerPath": "C:\\devkitPro\\devkitARM\\bin\\arm-none-eabi-gdb.exe",
|
||||
"miDebuggerServerAddress": "localhost:4003",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing",
|
||||
"text": "file ${workspaceFolder}/testgame/testgame.elf -enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
118
.vscode/settings.json
vendored
Normal file
118
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,118 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"array": "cpp",
|
||||
"*.tcc": "cpp",
|
||||
"cctype": "cpp",
|
||||
"clocale": "cpp",
|
||||
"cmath": "cpp",
|
||||
"cstdarg": "cpp",
|
||||
"cstddef": "cpp",
|
||||
"cstdint": "cpp",
|
||||
"cstdio": "cpp",
|
||||
"cstdlib": "cpp",
|
||||
"cwchar": "cpp",
|
||||
"cwctype": "cpp",
|
||||
"unordered_map": "cpp",
|
||||
"vector": "cpp",
|
||||
"exception": "cpp",
|
||||
"algorithm": "cpp",
|
||||
"functional": "cpp",
|
||||
"iterator": "cpp",
|
||||
"memory": "cpp",
|
||||
"numeric": "cpp",
|
||||
"type_traits": "cpp",
|
||||
"fstream": "cpp",
|
||||
"initializer_list": "cpp",
|
||||
"iosfwd": "cpp",
|
||||
"iostream": "cpp",
|
||||
"istream": "cpp",
|
||||
"limits": "cpp",
|
||||
"new": "cpp",
|
||||
"optional": "cpp",
|
||||
"ostream": "cpp",
|
||||
"sstream": "cpp",
|
||||
"stdexcept": "cpp",
|
||||
"streambuf": "cpp",
|
||||
"string": "cpp",
|
||||
"string_view": "cpp",
|
||||
"system_error": "cpp",
|
||||
"tuple": "cpp",
|
||||
"typeinfo": "cpp",
|
||||
"utility": "cpp",
|
||||
"atomic": "cpp",
|
||||
"bit": "cpp",
|
||||
"bitset": "cpp",
|
||||
"chrono": "cpp",
|
||||
"codecvt": "cpp",
|
||||
"condition_variable": "cpp",
|
||||
"cstring": "cpp",
|
||||
"ctime": "cpp",
|
||||
"deque": "cpp",
|
||||
"forward_list": "cpp",
|
||||
"map": "cpp",
|
||||
"iomanip": "cpp",
|
||||
"memory_resource": "cpp",
|
||||
"ratio": "cpp",
|
||||
"regex": "cpp",
|
||||
"shared_mutex": "cpp",
|
||||
"valarray": "cpp",
|
||||
"random": "cpp",
|
||||
"cuchar": "cpp",
|
||||
"compare": "cpp",
|
||||
"concepts": "cpp",
|
||||
"numbers": "cpp",
|
||||
"filesystem": "cpp",
|
||||
"xstring": "cpp",
|
||||
"charconv": "cpp",
|
||||
"format": "cpp",
|
||||
"ios": "cpp",
|
||||
"list": "cpp",
|
||||
"locale": "cpp",
|
||||
"mutex": "cpp",
|
||||
"stack": "cpp",
|
||||
"stop_token": "cpp",
|
||||
"thread": "cpp",
|
||||
"xfacet": "cpp",
|
||||
"xhash": "cpp",
|
||||
"xiosbase": "cpp",
|
||||
"xlocale": "cpp",
|
||||
"xlocbuf": "cpp",
|
||||
"xlocinfo": "cpp",
|
||||
"xlocmes": "cpp",
|
||||
"xlocmon": "cpp",
|
||||
"xlocnum": "cpp",
|
||||
"xloctime": "cpp",
|
||||
"xmemory": "cpp",
|
||||
"xstddef": "cpp",
|
||||
"xtr1common": "cpp",
|
||||
"xtree": "cpp",
|
||||
"xutility": "cpp",
|
||||
"queue": "cpp",
|
||||
"semaphore": "cpp",
|
||||
"hash_map": "cpp",
|
||||
"set": "cpp",
|
||||
"unordered_set": "cpp",
|
||||
"source_location": "cpp",
|
||||
"future": "cpp",
|
||||
"cfenv": "cpp",
|
||||
"cinttypes": "cpp",
|
||||
"typeindex": "cpp",
|
||||
"variant": "cpp",
|
||||
"ranges": "cpp",
|
||||
"span": "cpp",
|
||||
"coroutine": "cpp",
|
||||
"__bit_reference": "cpp",
|
||||
"__config": "cpp",
|
||||
"__debug": "cpp",
|
||||
"__errc": "cpp",
|
||||
"__hash_table": "cpp",
|
||||
"__locale": "cpp",
|
||||
"__mutex_base": "cpp",
|
||||
"__node_handle": "cpp",
|
||||
"__split_buffer": "cpp",
|
||||
"__threading_support": "cpp",
|
||||
"__tree": "cpp",
|
||||
"__verbose_abort": "cpp",
|
||||
"complex": "cpp"
|
||||
}
|
||||
}
|
37
.vscode/tasks.json
vendored
Normal file
37
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Build",
|
||||
"command": "make",
|
||||
"type": "shell",
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/rd7tf/"
|
||||
},
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "new",
|
||||
"focus": true
|
||||
},
|
||||
"problemMatcher": [],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Format",
|
||||
"command": "python ${workspaceFolder}/clang-format.py",
|
||||
"type": "shell",
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/"
|
||||
},
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "new",
|
||||
"focus": true
|
||||
},
|
||||
"problemMatcher": []
|
||||
}
|
||||
]
|
||||
}
|
112
CHANGELOG.md
Normal file
112
CHANGELOG.md
Normal file
@ -0,0 +1,112 @@
|
||||
# RenderD7 Changelog
|
||||
## 0.9.5
|
||||
- Remove Npi Intro and NVID Api
|
||||
- Replace Toasts System with Message
|
||||
- Added GetTime
|
||||
- Move from Draw to Render2 Api
|
||||
- Implement RD7Color and R7Vec2
|
||||
- Add new Features to Color::RGBA
|
||||
- Cleanup Code
|
||||
- Added RenderD7 Keyboard (Overlay)
|
||||
- Added Ftrace Overlay
|
||||
- Moved MetrikOVL into an Overlay
|
||||
- Removed Old Font/Text Handlers
|
||||
- Added UI7 (New UI Api)
|
||||
- Remove Old UI Api
|
||||
- Rewrite of RenderD7::Image
|
||||
- Internal Debugger/Database (IDB)
|
||||
- Removed BitmapPrinter
|
||||
- Added nimg and swr(render2nimg | SoftwareRender)
|
||||
- Removed Old Error/Message Handler
|
||||
- GetTextSize (extra buffer) + New TextShorter
|
||||
- Require specific FLAG for MemTrack
|
||||
- Replace all lodepng usage by stb_image
|
||||
- Move Asset Generator into single python script
|
||||
- Remove INI reader
|
||||
- Python based clangformat script
|
||||
- Move some Init code into functions to not use twice
|
||||
- Added Font class
|
||||
- Add LinearAllocator (for std)
|
||||
- Fix Crash in FilsSystem
|
||||
- Implement basic Theme System
|
||||
- Remove 0.9.4 Security
|
||||
- Tasks now based on std functional/thread
|
||||
- Add Network Support (Download Files, APi Requests)
|
||||
- Remove RD7TF
|
||||
- Add Cia Installer
|
||||
- Move from Init bool values to flags
|
||||
## 0.9.4
|
||||
- Implement new Security System To prevent from crashes
|
||||
- Implement Functiontrace for better Timing Tests
|
||||
- Implement MemAlloc Tracker (only size)
|
||||
- Add some new Overlays (not functional yet)
|
||||
- Complete Rewrite of Overlay System
|
||||
- Fixed the FrameEnd Crash
|
||||
- New System to get Hardware Info
|
||||
- Removed RenderD7 Super Reselution (800px mode)
|
||||
## 0.9.3
|
||||
- Completly Documented Everything
|
||||
- Fix typo in Sprite::getHeight
|
||||
- Remove Deprecated/Useless Stuff
|
||||
## 0.9.2
|
||||
- Add Nvid Support(v0.0.1)
|
||||
- Add Basic RenderD7 Splash
|
||||
- Faster Graphics Init
|
||||
- Fade Effects
|
||||
- Fix Changelog Screen
|
||||
## 0.9.1
|
||||
- Fix Critical bug in Spritesheet animations
|
||||
- Fix RenderD7::Color::Hex (Major performance tweak)
|
||||
## 0.9.0
|
||||
- Remove Stupid try of Console
|
||||
- Add Services list
|
||||
- Clean up Code
|
||||
- Added Minimal Init for hax2.x
|
||||
## 0.8.5
|
||||
- Fix Deltatime
|
||||
## 0.8.4
|
||||
- A lot of Fixes
|
||||
- New Features for BitmapPrinter
|
||||
## 0.8.3
|
||||
- Added Overlaycount to Info
|
||||
- Addet ResultDecoder for errors
|
||||
## 0.8.2
|
||||
- Fix a lot of Stuff
|
||||
- Use c++17 std::filesystem for RenderD7::Filesystem
|
||||
## 0.8.1
|
||||
- Add abillity to Get Stdout as string to render it to the screen.
|
||||
## 0.8.0
|
||||
- Implement BitmapPrinter
|
||||
## 0.7.3
|
||||
- Implement Over Render Overlay Framework
|
||||
## 0.7.2
|
||||
- Implement MT to csv file saving
|
||||
- Add RGB2HEX
|
||||
## 0.7.1
|
||||
- Add the New Overlay Handler. Its Just in code and does nothing yet
|
||||
## 0.7.0
|
||||
- Made Big Progress In the MT Ovl but it still crashes On a 2nd C3D_FrameEnd \
|
||||
- Implement 800px but doesn't work that good
|
||||
## 0.6.2
|
||||
- Fix Crash when exiting through Home Menu.
|
||||
## 0.6.10
|
||||
- Rewrite Threadsystem
|
||||
- Improve framerate
|
||||
## 0.6.02
|
||||
- Fix Code in lang.hpp
|
||||
- Add Draw Text Left Function (Right since 0.7.0)
|
||||
- Add changelog
|
||||
## 0.6.01
|
||||
- Add Threading system
|
||||
## 0.6.0
|
||||
- Better Scene Management
|
||||
## 0.5.0
|
||||
- Fixed some Bugs!
|
||||
## 0.4.0
|
||||
- Trying to fix Filesystem and Bugs
|
||||
## 0.3.0
|
||||
- Recreate D7-Core into RenderD7
|
||||
## 0.2.0
|
||||
- Trying to create Animations of Images instead of Sheets
|
||||
## 0.1.0
|
||||
- Inital Release of D7-Core sprite animation plugin
|
695
LICENSE
695
LICENSE
@ -1,674 +1,21 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 tobid7
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
63
README.md
63
README.md
@ -1,2 +1,61 @@
|
||||
# RenderD7
|
||||
Simple and Easey to use UI and Graphics helper.
|
||||
# <img alt="LOGO" src="https://dev.npid7.de/tobid7/RenderD7/raw/branch/main/logo.png" height="90">
|
||||
# RenderD7 as Submodule (0.9.5+)
|
||||
To use RenderD7 just use this command: `git submodule add https://github.com/NPI-D7/RenderD7` and add `-b v0.9.5` for example for a specific version.
|
||||
|
||||
|
||||
And in Your Project Makefile add this
|
||||
```
|
||||
# Make Sure to Change this paths if your Submodule
|
||||
# is located somewhere else
|
||||
RENDERD7_SRC := RenderD7/source RenderD7/external
|
||||
RENDERD7_INC := RenderD7/include
|
||||
# Libraries used for RenderD7
|
||||
# if you already use -lm, -lctru etc place a # before -lm
|
||||
RENDERD7_LIBS := -lcurl -lmbedtls -lmbedx509 -lmbedcrypto -lz -lm -lcitro2dd -lcitro3d -lctru
|
||||
```
|
||||
Now you need to add it to your sources and includes
|
||||
```
|
||||
SOURCES := source $(RENDERD7_SRC)
|
||||
INCLUDES := source $(RENDERD7_INC)
|
||||
```
|
||||
|
||||
Example from rd7tf
|
||||
### Installation (0.8.0-0.9.4) (OUTDATED)
|
||||
Download a Package From Releses Page
|
||||
`https://github.com/NPI-D7/RenderD7/releases/download/v0.9.4/renderd7.tar.bz2 -o renderd7.tar.bz2`
|
||||
Then Extract it to your Libraries Path
|
||||
`bzip2 -cd renderd7.tar.bz2 | tar -xf - -C path_to_your_libs`
|
||||
Finally put `-lrenderd7` to the First Place and add the path_to_your_libs
|
||||
```
|
||||
LIBS := -lrenderd7 -lcurl -lstdc++ -lm -lcitro2d -lcitro3d -lctru
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(PORTLIBS) $(CTRULIB) ../path_to_your_libs
|
||||
```
|
||||
Make sure that `-lrenderd7` is before `-lcitro2d`, `-lcitro3d`, `-lctru`.
|
||||
Here an example tree
|
||||
```
|
||||
Example-App
|
||||
├── gfx
|
||||
├── libs
|
||||
│ ├── include
|
||||
│ │ ├── rd7.hpp
|
||||
│ │ └── renderd7
|
||||
│ └── lib
|
||||
│ ├── librenderd7.a
|
||||
│ └── librenderd7d.a
|
||||
├── Makefile
|
||||
├── romfs
|
||||
│ └── gfx
|
||||
└── src
|
||||
└── main.cpp
|
||||
```
|
||||
# Credits
|
||||
- NPI-D7
|
||||
- Tobi-D7 Main Dev
|
||||
|
||||
Some Icons are From
|
||||
https://icons8.de/
|
||||
See Subfolder Readmes
|
||||
|
3
assets/resources/renderd7_logo.t3s
Normal file
3
assets/resources/renderd7_logo.t3s
Normal file
@ -0,0 +1,3 @@
|
||||
--atlas -f rgba -z auto
|
||||
|
||||
renderd7_logo/renderd7_logo.png
|
BIN
assets/resources/renderd7_logo/renderd7_logo.png
Normal file
BIN
assets/resources/renderd7_logo/renderd7_logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
27
clang-format.py
Normal file
27
clang-format.py
Normal file
@ -0,0 +1,27 @@
|
||||
import subprocess
|
||||
import glob
|
||||
from pathlib import Path
|
||||
# Format script
|
||||
|
||||
def fmt_file(path):
|
||||
if Path(path).is_dir():
|
||||
return # Skip
|
||||
try:
|
||||
subprocess.run(['clang-format', '-i', path, '--style=Google'], check=True)
|
||||
except subprocess.CalledProcessError as e:
|
||||
print('Error for ' + Path(path).stem + ': ' + e)
|
||||
|
||||
def fmt_dir(path):
|
||||
sources = glob.glob(path+'/*')
|
||||
for file in sources:
|
||||
fmt_file(file)
|
||||
|
||||
print('Formatting...')
|
||||
fmt_dir('source')
|
||||
fmt_dir('include')
|
||||
fmt_dir('include/renderd7')
|
||||
|
||||
# Format LE and TF as well
|
||||
fmt_dir('rd7tf/source')
|
||||
#fmt_dir('rd7le/source')
|
||||
print('Done')
|
18
docs/javascripts/mathjax.js
Normal file
18
docs/javascripts/mathjax.js
Normal file
@ -0,0 +1,18 @@
|
||||
<div class="md-copyright">
|
||||
{% if config.copyright %}
|
||||
<div class="md-copyright__highlight">
|
||||
{{ config.copyright }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if not config.extra.generator == false %}
|
||||
Made with
|
||||
<a href="https://doxide.org" target="_blank" rel="noopener">
|
||||
Doxide
|
||||
</a>
|
||||
and
|
||||
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
|
||||
Material for MkDocs
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
18
docs/overrides/partials/copyright.html
Normal file
18
docs/overrides/partials/copyright.html
Normal file
@ -0,0 +1,18 @@
|
||||
<div class="md-copyright">
|
||||
{% if config.copyright %}
|
||||
<div class="md-copyright__highlight">
|
||||
{{ config.copyright }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if not config.extra.generator == false %}
|
||||
Made with
|
||||
<a href="https://doxide.org" target="_blank" rel="noopener">
|
||||
Doxide
|
||||
</a>
|
||||
and
|
||||
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
|
||||
Material for MkDocs
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
49
docs/stylesheets/doxide.css
Normal file
49
docs/stylesheets/doxide.css
Normal file
@ -0,0 +1,49 @@
|
||||
:root {
|
||||
--md-admonition-icon--variable: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.41 3c1.39 2.71 1.94 5.84 1.59 9-.2 3.16-1.3 6.29-3.17 9l-1.53-1c1.61-2.43 2.55-5.2 2.7-8 .34-2.8-.11-5.57-1.3-8l1.71-1M5.17 3 6.7 4C5.09 6.43 4.15 9.2 4 12c-.34 2.8.12 5.57 1.3 8l-1.69 1c-1.4-2.71-1.96-5.83-1.61-9 .2-3.16 1.3-6.29 3.17-9m6.91 7.68 2.32-3.23h2.53l-3.78 5 2.2 4.92h-2.26L11.71 14l-2.43 3.33H6.76l3.9-5.12-2.13-4.76h2.27l1.28 3.23Z"/></svg>');
|
||||
--md-admonition-icon--function: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.6 5.29c-1.1-.1-2.07.71-2.17 1.82L13.18 10H16v2h-3l-.44 5.07a3.986 3.986 0 0 1-4.33 3.63 4.007 4.007 0 0 1-3.06-1.87l1.5-1.5c.24.74.9 1.31 1.73 1.38 1.1.1 2.07-.71 2.17-1.82L11 12H8v-2h3.17l.27-3.07c.19-2.2 2.13-3.83 4.33-3.63 1.31.11 2.41.84 3.06 1.87l-1.5 1.5c-.24-.74-.9-1.31-1.73-1.38Z"/></svg>');
|
||||
--md-admonition-icon--concept: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3.75 3.5a.25.25 0 0 0-.25.25v2.062a.75.75 0 1 1-1.5 0V3.75C2 2.783 2.783 2 3.75 2h2.062a.75.75 0 1 1 0 1.5Zm13.688-.75a.75.75 0 0 1 .75-.75h2.062c.966 0 1.75.783 1.75 1.75v2.062a.75.75 0 1 1-1.5 0V3.75a.25.25 0 0 0-.25-.25h-2.062a.75.75 0 0 1-.75-.75ZM2.75 17.438a.75.75 0 0 1 .75.75v2.062c0 .138.112.25.25.25h2.062a.75.75 0 1 1 0 1.5H3.75A1.75 1.75 0 0 1 2 20.25v-2.062a.75.75 0 0 1 .75-.75Zm18.5 0a.75.75 0 0 1 .75.75v2.062A1.75 1.75 0 0 1 20.25 22h-2.062a.75.75 0 1 1 0-1.5h2.062a.25.25 0 0 0 .25-.25v-2.062a.75.75 0 0 1 .75-.75Zm-18.5-8.25a.75.75 0 0 1 .75.75v4.124a.75.75 0 1 1-1.5 0V9.938a.75.75 0 0 1 .75-.75ZM9.188 2.75a.75.75 0 0 1 .75-.75h4.124a.75.75 0 1 1 0 1.5H9.938a.75.75 0 0 1-.75-.75Zm0 18.5a.75.75 0 0 1 .75-.75h4.124a.75.75 0 1 1 0 1.5H9.938a.75.75 0 0 1-.75-.75ZM21.25 9.188a.75.75 0 0 1 .75.75v4.124a.75.75 0 1 1-1.5 0V9.938a.75.75 0 0 1 .75-.75ZM3.75 8.25a.75.75 0 0 1 .75-.75h2a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1-.75-.75Zm5.5 0A.75.75 0 0 1 10 7.5h2A.75.75 0 0 1 12 9h-2a.75.75 0 0 1-.75-.75Zm-1-4.5A.75.75 0 0 1 9 4.5v2a.75.75 0 0 1-1.5 0v-2a.75.75 0 0 1 .75-.75Zm0 5.5A.75.75 0 0 1 9 10v2a.75.75 0 0 1-1.5 0v-2a.75.75 0 0 1 .75-.75Zm0 4.75a.75.75 0 0 1 .75.75v4a.75.75 0 0 1-1.5 0v-4a.75.75 0 0 1 .75-.75ZM14 8.25a.75.75 0 0 1 .75-.75h4a.75.75 0 0 1 0 1.5h-4a.75.75 0 0 1-.75-.75Z"/></svg>');
|
||||
--md-admonition-icon--macro: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m5.41 21 .71-4h-4l.35-2h4l1.06-6h-4l.35-2h4l.71-4h2l-.71 4h6l.71-4h2l-.71 4h4l-.35 2h-4l-1.06 6h4l-.35 2h-4l-.71 4h-2l.71-4h-6l-.71 4h-2M9.53 9l-1.06 6h6l1.06-6h-6Z"/></svg>');
|
||||
}
|
||||
|
||||
.md-typeset .admonition.variable, .md-typeset details.variable,
|
||||
.md-typeset .admonition.function, .md-typeset details.function,
|
||||
.md-typeset .admonition.concept, .md-typeset details.concept,
|
||||
.md-typeset .admonition.macro, .md-typeset details.macro {
|
||||
border-color: var(--md-default-fg-color--lighter);
|
||||
}
|
||||
|
||||
.md-typeset .variable > .admonition-title, .md-typeset .variable > summary,
|
||||
.md-typeset .function > .admonition-title, .md-typeset .function > summary,
|
||||
.md-typeset .concept > .admonition-title, .md-typeset .concept > summary,
|
||||
.md-typeset .macro > .admonition-title, .md-typeset .macro > summary {
|
||||
background-color: var(--md-default-bg-color);
|
||||
}
|
||||
|
||||
.md-typeset .variable > .admonition-title::before,
|
||||
.md-typeset .variable > summary::before {
|
||||
background-color: var(--md-default-fg-color--light);
|
||||
-webkit-mask-image: var(--md-admonition-icon--variable);
|
||||
mask-image: var(--md-admonition-icon--variable);
|
||||
}
|
||||
|
||||
.md-typeset .function > .admonition-title::before,
|
||||
.md-typeset .function > summary::before {
|
||||
background-color: var(--md-default-fg-color--light);
|
||||
-webkit-mask-image: var(--md-admonition-icon--function);
|
||||
mask-image: var(--md-admonition-icon--function);
|
||||
}
|
||||
|
||||
.md-typeset .concept > .admonition-title::before,
|
||||
.md-typeset .concept > summary::before {
|
||||
background-color: var(--md-default-fg-color--light);
|
||||
-webkit-mask-image: var(--md-admonition-icon--concept);
|
||||
mask-image: var(--md-admonition-icon--concept);
|
||||
}
|
||||
|
||||
.md-typeset .macro > .admonition-title::before,
|
||||
.md-typeset .macro > summary::before {
|
||||
background-color: var(--md-default-fg-color--light);
|
||||
-webkit-mask-image: var(--md-admonition-icon--macro);
|
||||
mask-image: var(--md-admonition-icon--macro);
|
||||
}
|
||||
|
9
doxide.yaml
Normal file
9
doxide.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
title: RenderD7
|
||||
description:
|
||||
files:
|
||||
- "include/*.hpp"
|
||||
- "include/renderd7/*.hpp"
|
||||
- "include/renderd7/music/*.hpp"
|
||||
- "include/*.h"
|
||||
- "include/renderd7/*.h"
|
||||
- "include/renderd7/music/*.h"
|
320
external/fs.c
vendored
320
external/fs.c
vendored
@ -1,320 +0,0 @@
|
||||
#include "external/fs.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
void Utils_U8_To_U16(u16 *buf, const u8 *input, size_t bufsize) {
|
||||
ssize_t units = utf8_to_utf16(buf, input, bufsize);
|
||||
|
||||
if (units < 0)
|
||||
units = 0;
|
||||
|
||||
buf[units] = 0;
|
||||
}
|
||||
|
||||
FS_Archive archive, sdmc_archive, nand_archive;
|
||||
|
||||
Result FS_OpenArchive(FS_Archive *archive, FS_ArchiveID archiveID) {
|
||||
Result ret = 0;
|
||||
|
||||
if (R_FAILED(ret = FSUSER_OpenArchive(archive, archiveID, fsMakePath(PATH_EMPTY, ""))))
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Result FS_CloseArchive(FS_Archive archive) {
|
||||
Result ret = 0;
|
||||
|
||||
if (R_FAILED(ret = FSUSER_CloseArchive(archive)))
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Result FS_OpenDir(Handle *handle, FS_Archive archive, const char *path) {
|
||||
Result ret = 0;
|
||||
|
||||
u16 path_u16[strlen(path) + 1];
|
||||
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
|
||||
|
||||
if (R_FAILED(ret = FSUSER_OpenDirectory(handle, archive, fsMakePath(PATH_UTF16, path_u16))))
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Result FS_OpenFile(Handle *handle, FS_Archive archive, const char *path, u32 flags, u32 attributes) {
|
||||
Result ret = 0;
|
||||
|
||||
u16 path_u16[strlen(path) + 1];
|
||||
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
|
||||
|
||||
if (R_FAILED(ret = FSUSER_OpenFile(handle, archive, fsMakePath(PATH_UTF16, path_u16), flags, attributes)))
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Result FS_MakeDir(FS_Archive archive, const char *path) {
|
||||
Result ret = 0;
|
||||
|
||||
u16 path_u16[strlen(path) + 1];
|
||||
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
|
||||
|
||||
if (R_FAILED(ret = FSUSER_CreateDirectory(archive, fsMakePath(PATH_UTF16, path_u16), 0)))
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Result FS_CreateFile(FS_Archive archive, const char *path, u64 size) {
|
||||
Result ret = 0;
|
||||
|
||||
u16 path_u16[strlen(path) + 1];
|
||||
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
|
||||
|
||||
if (R_FAILED(ret = FSUSER_CreateFile(archive, fsMakePath(PATH_UTF16, path_u16), 0, size)))
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Result FS_RecursiveMakeDir(FS_Archive archive, const char *path) {
|
||||
Result ret = 0;
|
||||
char buf[256];
|
||||
char *p = NULL;
|
||||
size_t len;
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s", path);
|
||||
len = strlen(buf);
|
||||
|
||||
if (buf[len - 1] == '/')
|
||||
buf[len - 1] = 0;
|
||||
|
||||
for (p = buf + 1; *p; p++) {
|
||||
if (*p == '/') {
|
||||
*p = 0;
|
||||
|
||||
if (!FS_DirExists(archive, buf))
|
||||
ret = FS_MakeDir(archive, buf);
|
||||
|
||||
*p = '/';
|
||||
}
|
||||
|
||||
if (!FS_DirExists(archive, buf))
|
||||
ret = FS_MakeDir(archive, buf);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool FS_FileExists(FS_Archive archive, const char *path) {
|
||||
Handle handle;
|
||||
|
||||
u16 path_u16[strlen(path) + 1];
|
||||
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
|
||||
|
||||
if (R_FAILED(FSUSER_OpenFile(&handle, archive, fsMakePath(PATH_UTF16, path_u16), FS_OPEN_READ, 0)))
|
||||
return false;
|
||||
|
||||
if (R_FAILED(FSFILE_Close(handle)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FS_DirExists(FS_Archive archive, const char *path) {
|
||||
Handle handle;
|
||||
|
||||
u16 path_u16[strlen(path) + 1];
|
||||
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
|
||||
|
||||
if (R_FAILED(FSUSER_OpenDirectory(&handle, archive, fsMakePath(PATH_UTF16, path_u16))))
|
||||
return false;
|
||||
|
||||
if (R_FAILED(FSDIR_Close(handle)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Result FS_GetFileSize(FS_Archive archive, const char *path, u64 *size) {
|
||||
Result ret = 0;
|
||||
Handle handle;
|
||||
|
||||
u16 path_u16[strlen(path) + 1];
|
||||
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
|
||||
|
||||
if (R_FAILED(ret = FSUSER_OpenFile(&handle, archive, fsMakePath(PATH_UTF16, path_u16), FS_OPEN_READ, 0)))
|
||||
return ret;
|
||||
|
||||
if (R_FAILED(ret = FSFILE_GetSize(handle, size))) {
|
||||
FSFILE_Close(handle);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (R_FAILED(ret = FSFILE_Close(handle)))
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
u64 FS_GetFreeStorage(FS_SystemMediaType media_type) {
|
||||
FS_ArchiveResource resource = {0};
|
||||
|
||||
if (R_SUCCEEDED(FSUSER_GetArchiveResource(&resource, media_type)))
|
||||
return (((u64)resource.freeClusters * (u64)resource.clusterSize));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
u64 FS_GetTotalStorage(FS_SystemMediaType media_type) {
|
||||
FS_ArchiveResource resource = {0};
|
||||
|
||||
if (R_SUCCEEDED(FSUSER_GetArchiveResource(&resource, media_type)))
|
||||
return (((u64)resource.totalClusters * (u64)resource.clusterSize));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
u64 FS_GetUsedStorage(FS_SystemMediaType media_type) {
|
||||
return (FS_GetTotalStorage(media_type) - FS_GetUsedStorage(media_type));
|
||||
}
|
||||
|
||||
Result FS_RemoveFile(FS_Archive archive, const char *path) {
|
||||
Result ret = 0;
|
||||
|
||||
u16 path_u16[strlen(path) + 1];
|
||||
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
|
||||
|
||||
if (R_FAILED(ret = FSUSER_DeleteFile(archive, fsMakePath(PATH_UTF16, path_u16))))
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Result FS_RemoveDir(FS_Archive archive, const char *path) {
|
||||
Result ret = 0;
|
||||
|
||||
u16 path_u16[strlen(path) + 1];
|
||||
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
|
||||
|
||||
if (R_FAILED(ret = FSUSER_DeleteDirectory(archive, fsMakePath(PATH_UTF16, path_u16))))
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Result FS_RemoveDirRecursive(FS_Archive archive, const char *path) {
|
||||
Result ret = 0;
|
||||
|
||||
u16 path_u16[strlen(path) + 1];
|
||||
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
|
||||
|
||||
if (R_FAILED(ret = FSUSER_DeleteDirectoryRecursively(archive, fsMakePath(PATH_UTF16, path_u16))))
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Result FS_RenameFile(FS_Archive archive, const char *old_filename, const char *new_filename) {
|
||||
Result ret = 0;
|
||||
|
||||
u16 old_filename_u16[strlen(old_filename) + 1];
|
||||
Utils_U8_To_U16(old_filename_u16, (const u8 *)old_filename, strlen(old_filename) + 1);
|
||||
|
||||
u16 new_filename_u16[strlen(new_filename) + 1];
|
||||
Utils_U8_To_U16(new_filename_u16, (const u8 *)new_filename, strlen(new_filename) + 1);
|
||||
|
||||
if (R_FAILED(ret = FSUSER_RenameFile(archive, fsMakePath(PATH_UTF16, old_filename_u16), archive, fsMakePath(PATH_UTF16, new_filename_u16))))
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Result FS_RenameDir(FS_Archive archive, const char *old_dirname, const char *new_dirname) {
|
||||
Result ret = 0;
|
||||
|
||||
u16 old_dirname_u16[strlen(old_dirname) + 1];
|
||||
Utils_U8_To_U16(old_dirname_u16, (const u8 *)old_dirname, strlen(old_dirname) + 1);
|
||||
|
||||
u16 new_dirname_u16[strlen(new_dirname) + 1];
|
||||
Utils_U8_To_U16(new_dirname_u16, (const u8 *)new_dirname, strlen(new_dirname) + 1);
|
||||
|
||||
if (R_FAILED(ret = FSUSER_RenameDirectory(archive, fsMakePath(PATH_UTF16, old_dirname_u16), archive, fsMakePath(PATH_UTF16, new_dirname_u16))))
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Result FS_Read(FS_Archive archive, const char *path, u64 size, void *buf) {
|
||||
Result ret = 0;
|
||||
Handle handle;
|
||||
|
||||
u32 bytes_read = 0;
|
||||
|
||||
if (R_FAILED(ret = FS_OpenFile(&handle, archive, path, FS_OPEN_READ, 0)))
|
||||
return ret;
|
||||
|
||||
if (R_FAILED(ret = FSFILE_Read(handle, &bytes_read, 0, buf, size))) {
|
||||
FSFILE_Close(handle);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (R_FAILED(ret = FSFILE_Close(handle)))
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Result FS_Write(FS_Archive archive, const char *path, const void *buf, u32 size) {
|
||||
Result ret = 0;
|
||||
Handle handle;
|
||||
u32 bytes_written = 0;
|
||||
|
||||
if (FS_FileExists(archive, path))
|
||||
FS_RemoveFile(archive, path);
|
||||
|
||||
u16 path_u16[strlen(path) + 1];
|
||||
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
|
||||
|
||||
if (R_FAILED(ret = FSUSER_CreateFile(archive, fsMakePath(PATH_UTF16, path_u16), 0, size)))
|
||||
return ret;
|
||||
|
||||
if (R_FAILED(ret = FSUSER_OpenFile(&handle, archive, fsMakePath(PATH_UTF16, path_u16), FS_OPEN_WRITE, 0)))
|
||||
return ret;
|
||||
|
||||
if (R_FAILED(ret = FSFILE_Write(handle, &bytes_written, 0, buf, size, FS_WRITE_FLUSH))) {
|
||||
FSFILE_Close(handle);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (R_FAILED(ret = FSFILE_Close(handle)))
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *FS_GetFileTimestamp(const char *path) {
|
||||
static char timeStr[60];
|
||||
u64 mtime = 0;
|
||||
|
||||
if (R_SUCCEEDED(archive_getmtime(path, &mtime))) {
|
||||
time_t mt = mtime;
|
||||
struct tm *timeStruct = gmtime(&mt);
|
||||
|
||||
int hours = timeStruct->tm_hour;
|
||||
int minutes = timeStruct->tm_min;
|
||||
|
||||
int day = timeStruct->tm_mday;
|
||||
int month = timeStruct->tm_mon + 1; // January being 0
|
||||
int year = timeStruct->tm_year + 1900;
|
||||
|
||||
snprintf(timeStr, 60, "%d/%d/%d %2i:%02i", year, month, day, hours, minutes);
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
|
||||
return timeStr;
|
||||
}
|
30
external/fs.h
vendored
30
external/fs.h
vendored
@ -1,30 +0,0 @@
|
||||
#ifndef _3D_SHELL_FS_H
|
||||
#define _3D_SHELL_FS_H
|
||||
|
||||
#include <3ds.h>
|
||||
|
||||
extern FS_Archive archive, sdmc_archive, nand_archive;
|
||||
|
||||
Result FS_OpenArchive(FS_Archive *archive, FS_ArchiveID id);
|
||||
Result FS_CloseArchive(FS_Archive archive);
|
||||
Result FS_OpenDir(Handle *handle, FS_Archive archive, const char *path);
|
||||
Result FS_OpenFile(Handle *handle, FS_Archive archive, const char *path, u32 flags, u32 attributes);
|
||||
Result FS_MakeDir(FS_Archive archive, const char *path);
|
||||
Result FS_CreateFile(FS_Archive archive, const char *path, u64 size);
|
||||
Result FS_RecursiveMakeDir(FS_Archive archive, const char *path);
|
||||
bool FS_FileExists(FS_Archive archive, const char *path);
|
||||
bool FS_DirExists(FS_Archive archive, const char *path);
|
||||
Result FS_GetFileSize(FS_Archive archive, const char *path, u64 *size);
|
||||
u64 FS_GetFreeStorage(FS_SystemMediaType media_type);
|
||||
u64 FS_GetTotalStorage(FS_SystemMediaType media_type);
|
||||
u64 FS_GetUsedStorage(FS_SystemMediaType media_type);
|
||||
Result FS_RemoveFile(FS_Archive archive, const char *path);
|
||||
Result FS_RemoveDir(FS_Archive archive, const char *path);
|
||||
Result FS_RemoveDirRecursive(FS_Archive archive, const char *path);
|
||||
Result FS_RenameFile(FS_Archive archive, const char *old_filename, const char *new_filename);
|
||||
Result FS_RenameDir(FS_Archive archive, const char *old_dirname, const char *new_dirname);
|
||||
Result FS_Read(FS_Archive archive, const char *path, u64 size, void *buf);
|
||||
Result FS_Write(FS_Archive archive, const char *path, const void *buf, u32 size);
|
||||
char *FS_GetFileTimestamp(const char *path);
|
||||
|
||||
#endif
|
6464
external/lodepng.cpp
vendored
6464
external/lodepng.cpp
vendored
File diff suppressed because it is too large
Load Diff
1977
external/lodepng.h
vendored
1977
external/lodepng.h
vendored
File diff suppressed because it is too large
Load Diff
44
external/tween-engine/Makefile
vendored
44
external/tween-engine/Makefile
vendored
@ -1,44 +0,0 @@
|
||||
PROJECT = libtween
|
||||
CXX = arm-none-eabi-g++
|
||||
AR = arm-none-eabi-ar
|
||||
CXXFLAGS = -g -Wall -pedantic -std=c++11 -fno-rtti -fno-exceptions
|
||||
|
||||
INCLUDES = -Iinclude/
|
||||
SOURCES = $(wildcard src/*.cpp) $(wildcard src/*/*.cpp)
|
||||
OBJECTS = $(SOURCES:src/%.cpp=build/arm/%.o)
|
||||
|
||||
TEST_CXX = g++
|
||||
TEST_AR = ar
|
||||
TEST_CXXFLAGS = -g -Wall -pedantic -std=c++11 -fno-rtti -fno-exceptions -DTESTING
|
||||
TEST_OBJECTS = $(SOURCES:src/%.cpp=build/test/%.o)
|
||||
|
||||
.PHONY: all dir clean test
|
||||
|
||||
all: dir $(PROJECT).a
|
||||
|
||||
test: dir $(PROJECT)-test.a
|
||||
|
||||
dir:
|
||||
@mkdir -p build/arm/equations
|
||||
@mkdir -p build/arm/paths
|
||||
@mkdir -p build/test/equations
|
||||
@mkdir -p build/test/paths
|
||||
@mkdir -p lib
|
||||
|
||||
$(PROJECT).a: $(OBJECTS)
|
||||
$(AR) rvs lib/$@ $^
|
||||
$(PROJECT)-test.a: $(TEST_OBJECTS)
|
||||
$(TEST_AR) rvs lib/$@ $^
|
||||
|
||||
clean:
|
||||
@rm -rf build
|
||||
@rm -rf lib
|
||||
@echo "Successfully cleaned."
|
||||
|
||||
build/arm/%.o: src/%.cpp
|
||||
$(CXX) $(INCLUDES) $(CXXFLAGS) -c $< -o $@
|
||||
$(CXX) -MM $< > build/arm/$*.d
|
||||
|
||||
build/test/%.o: src/%.cpp
|
||||
$(TEST_CXX) $(INCLUDES) $(TEST_CXXFLAGS) -c $< -o $@
|
||||
$(TEST_CXX) -MM $< > build/test/$*.d
|
1
external/tween-engine/build/arm/BaseTween.d
vendored
1
external/tween-engine/build/arm/BaseTween.d
vendored
@ -1 +0,0 @@
|
||||
BaseTween.o: src/BaseTween.cpp
|
BIN
external/tween-engine/build/arm/BaseTween.o
vendored
BIN
external/tween-engine/build/arm/BaseTween.o
vendored
Binary file not shown.
1
external/tween-engine/build/arm/Tween.d
vendored
1
external/tween-engine/build/arm/Tween.d
vendored
@ -1 +0,0 @@
|
||||
Tween.o: src/Tween.cpp
|
BIN
external/tween-engine/build/arm/Tween.o
vendored
BIN
external/tween-engine/build/arm/Tween.o
vendored
Binary file not shown.
@ -1 +0,0 @@
|
||||
TweenEquations.o: src/TweenEquations.cpp
|
BIN
external/tween-engine/build/arm/TweenEquations.o
vendored
BIN
external/tween-engine/build/arm/TweenEquations.o
vendored
Binary file not shown.
@ -1 +0,0 @@
|
||||
TweenManager.o: src/TweenManager.cpp
|
BIN
external/tween-engine/build/arm/TweenManager.o
vendored
BIN
external/tween-engine/build/arm/TweenManager.o
vendored
Binary file not shown.
1
external/tween-engine/build/arm/TweenPaths.d
vendored
1
external/tween-engine/build/arm/TweenPaths.d
vendored
@ -1 +0,0 @@
|
||||
TweenPaths.o: src/TweenPaths.cpp
|
BIN
external/tween-engine/build/arm/TweenPaths.o
vendored
BIN
external/tween-engine/build/arm/TweenPaths.o
vendored
Binary file not shown.
1
external/tween-engine/build/arm/TweenPool.d
vendored
1
external/tween-engine/build/arm/TweenPool.d
vendored
@ -1 +0,0 @@
|
||||
TweenPool.o: src/TweenPool.cpp
|
BIN
external/tween-engine/build/arm/TweenPool.o
vendored
BIN
external/tween-engine/build/arm/TweenPool.o
vendored
Binary file not shown.
@ -1 +0,0 @@
|
||||
Back.o: src/equations/Back.cpp
|
BIN
external/tween-engine/build/arm/equations/Back.o
vendored
BIN
external/tween-engine/build/arm/equations/Back.o
vendored
Binary file not shown.
@ -1 +0,0 @@
|
||||
Bounce.o: src/equations/Bounce.cpp
|
BIN
external/tween-engine/build/arm/equations/Bounce.o
vendored
BIN
external/tween-engine/build/arm/equations/Bounce.o
vendored
Binary file not shown.
@ -1 +0,0 @@
|
||||
Circ.o: src/equations/Circ.cpp
|
BIN
external/tween-engine/build/arm/equations/Circ.o
vendored
BIN
external/tween-engine/build/arm/equations/Circ.o
vendored
Binary file not shown.
@ -1 +0,0 @@
|
||||
Cubic.o: src/equations/Cubic.cpp
|
BIN
external/tween-engine/build/arm/equations/Cubic.o
vendored
BIN
external/tween-engine/build/arm/equations/Cubic.o
vendored
Binary file not shown.
@ -1 +0,0 @@
|
||||
Elastic.o: src/equations/Elastic.cpp
|
BIN
external/tween-engine/build/arm/equations/Elastic.o
vendored
BIN
external/tween-engine/build/arm/equations/Elastic.o
vendored
Binary file not shown.
@ -1 +0,0 @@
|
||||
Expo.o: src/equations/Expo.cpp
|
BIN
external/tween-engine/build/arm/equations/Expo.o
vendored
BIN
external/tween-engine/build/arm/equations/Expo.o
vendored
Binary file not shown.
@ -1 +0,0 @@
|
||||
Linear.o: src/equations/Linear.cpp
|
BIN
external/tween-engine/build/arm/equations/Linear.o
vendored
BIN
external/tween-engine/build/arm/equations/Linear.o
vendored
Binary file not shown.
@ -1 +0,0 @@
|
||||
Quad.o: src/equations/Quad.cpp
|
BIN
external/tween-engine/build/arm/equations/Quad.o
vendored
BIN
external/tween-engine/build/arm/equations/Quad.o
vendored
Binary file not shown.
@ -1 +0,0 @@
|
||||
Quart.o: src/equations/Quart.cpp
|
BIN
external/tween-engine/build/arm/equations/Quart.o
vendored
BIN
external/tween-engine/build/arm/equations/Quart.o
vendored
Binary file not shown.
@ -1 +0,0 @@
|
||||
Quint.o: src/equations/Quint.cpp
|
BIN
external/tween-engine/build/arm/equations/Quint.o
vendored
BIN
external/tween-engine/build/arm/equations/Quint.o
vendored
Binary file not shown.
@ -1 +0,0 @@
|
||||
Sine.o: src/equations/Sine.cpp
|
BIN
external/tween-engine/build/arm/equations/Sine.o
vendored
BIN
external/tween-engine/build/arm/equations/Sine.o
vendored
Binary file not shown.
@ -1 +0,0 @@
|
||||
CatmullRom.o: src/paths/CatmullRom.cpp
|
BIN
external/tween-engine/build/arm/paths/CatmullRom.o
vendored
BIN
external/tween-engine/build/arm/paths/CatmullRom.o
vendored
Binary file not shown.
@ -1 +0,0 @@
|
||||
LinearPath.o: src/paths/LinearPath.cpp
|
BIN
external/tween-engine/build/arm/paths/LinearPath.o
vendored
BIN
external/tween-engine/build/arm/paths/LinearPath.o
vendored
Binary file not shown.
@ -1,172 +0,0 @@
|
||||
//
|
||||
// BaseTween.h
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
/**
|
||||
* BaseTween is the base class of Tween and Timeline. It defines the
|
||||
* iteration engine used to play animations for any number of times, and in
|
||||
* any direction, at any speed.
|
||||
* <p/>
|
||||
*
|
||||
* It is responsible for calling the different callbacks at the right moments,
|
||||
* and for making sure that every callbacks are triggered, even if the update
|
||||
* engine gets a big delta time at once.
|
||||
*
|
||||
* @see Tween
|
||||
* @see Timeline
|
||||
* @author Aurelien Ribon | http://www.aurelienribon.com/
|
||||
*/
|
||||
|
||||
#ifndef __BaseTween__
|
||||
#define __BaseTween__
|
||||
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <TweenEngine/TweenCallback.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
class TweenManager;
|
||||
|
||||
typedef std::function<void(BaseTween* source)> TweenCallbackFunction;
|
||||
|
||||
class BaseTween
|
||||
{
|
||||
private:
|
||||
// General
|
||||
int step;
|
||||
int repeatCnt;
|
||||
bool isIterationStep;
|
||||
bool isYoyoFlag;
|
||||
|
||||
// Timings
|
||||
float repeatDelay;
|
||||
float currentTime;
|
||||
float deltaTime;
|
||||
bool isStartedFlag; // true when the object is started
|
||||
bool isInitializedFlag; // true after the delay
|
||||
bool isFinishedFlag; // true when all repetitions are done
|
||||
bool isKilledFlag; // true if kill() was called
|
||||
bool isPausedFlag; // true if pause() was called
|
||||
|
||||
// Misc
|
||||
TweenCallback *callback;
|
||||
int callbackTriggers;
|
||||
void *userData;
|
||||
std::map<int, TweenCallbackFunction> callbacks;
|
||||
|
||||
// Update
|
||||
void initialize();
|
||||
void testRelaunch();
|
||||
void updateStep();
|
||||
void testCompletion();
|
||||
|
||||
protected:
|
||||
// Timings
|
||||
float delayStart;
|
||||
float duration;
|
||||
|
||||
virtual void reset();
|
||||
virtual void forceStartValues() = 0;
|
||||
virtual void forceEndValues() = 0;
|
||||
virtual void initializeOverride();
|
||||
virtual void updateOverride(int step, int lastStep, bool isIterationStep, float delta);
|
||||
virtual void forceToStart();
|
||||
virtual void forceToEnd(float time);
|
||||
|
||||
void callCallback(int type);
|
||||
bool isReverse(int step);
|
||||
bool isValid(int step);
|
||||
|
||||
public:
|
||||
virtual ~BaseTween() {}
|
||||
|
||||
virtual int getTweenCount() = 0;
|
||||
virtual int getTimelineCount() = 0;
|
||||
|
||||
// Package access
|
||||
bool isAutoRemoveEnabled;
|
||||
bool isAutoStartEnabled;
|
||||
|
||||
virtual BaseTween &build();
|
||||
BaseTween &start();
|
||||
BaseTween &start(TweenManager &manager);
|
||||
BaseTween &delay(float delay);
|
||||
void kill();
|
||||
virtual void free();
|
||||
void pause();
|
||||
void resume();
|
||||
BaseTween &repeat(int count, float delay);
|
||||
BaseTween &repeatYoyo(int count, float delay);
|
||||
BaseTween &setCallback(TweenCallback *callback);
|
||||
BaseTween &setCallback(int type, const TweenCallbackFunction& callback);
|
||||
BaseTween &setCallbackTriggers(int flags);
|
||||
BaseTween &setUserData(void *data);
|
||||
|
||||
// Getters
|
||||
float getDelay();
|
||||
float getDuration();
|
||||
int getRepeatCount();
|
||||
float getRepeatDelay();
|
||||
float getFullDuration();
|
||||
void *getUserData();
|
||||
int getStep();
|
||||
float getCurrentTime();
|
||||
bool isStarted();
|
||||
bool isInitialized();
|
||||
bool isFinished();
|
||||
bool isYoyo();
|
||||
bool isPaused();
|
||||
|
||||
// Update
|
||||
void update(float delta);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* defined(__BaseTween__) */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
100
external/tween-engine/include/TweenEngine/Pool.h
vendored
100
external/tween-engine/include/TweenEngine/Pool.h
vendored
@ -1,100 +0,0 @@
|
||||
//
|
||||
// Pool.h
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
/**
|
||||
* A light pool of objects that can be resused to avoid allocation.
|
||||
* Based on Nathan Sweet pool implementation
|
||||
*/
|
||||
|
||||
#ifndef __Pool__
|
||||
#define __Pool__
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
|
||||
template<typename T>
|
||||
class PoolCallback
|
||||
{
|
||||
public:
|
||||
virtual void onPool(T *obj) = 0;
|
||||
virtual void onUnPool(T *obj) = 0;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class Pool
|
||||
{
|
||||
private:
|
||||
std::vector<T *> objects;
|
||||
PoolCallback<T> *callback;
|
||||
|
||||
protected:
|
||||
virtual ~Pool() {}
|
||||
virtual T *create()=0;
|
||||
|
||||
public:
|
||||
Pool(int initCapacity, PoolCallback<T> *callback);
|
||||
T *get();
|
||||
void free(T *obj);
|
||||
void clear();
|
||||
int size();
|
||||
void ensureCapacity(int minCapacity);
|
||||
|
||||
};
|
||||
|
||||
// Implementation
|
||||
template <typename T>
|
||||
Pool<T>::Pool(int initCapacity, PoolCallback<T> *cb) : objects(initCapacity), callback(cb)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T *Pool<T>::get()
|
||||
{
|
||||
T *obj = nullptr;
|
||||
if (objects.empty())
|
||||
{
|
||||
obj = create();
|
||||
}
|
||||
else
|
||||
{
|
||||
obj = objects.back();
|
||||
objects.pop_back();
|
||||
if (obj == nullptr) obj = create();
|
||||
}
|
||||
if (callback != nullptr) callback->onUnPool(obj);
|
||||
return obj;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void Pool<T>::free(T *obj)
|
||||
{
|
||||
if (obj == nullptr) return;
|
||||
|
||||
bool contains = (std::find(objects.begin(), objects.end(), obj) != objects.end());
|
||||
|
||||
if (!contains)
|
||||
{
|
||||
if (callback != nullptr) callback->onPool(obj);
|
||||
objects.push_back(obj);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void Pool<T>::clear() { objects.clear(); }
|
||||
|
||||
template <typename T>
|
||||
int Pool<T>::size() { return objects.size(); }
|
||||
|
||||
template <typename T>
|
||||
void Pool<T>::ensureCapacity(int minCapacity) { objects.reserve(minCapacity); }
|
||||
|
||||
}
|
||||
|
||||
#endif /* defined(__Pool__) */
|
116
external/tween-engine/include/TweenEngine/Tween.h
vendored
116
external/tween-engine/include/TweenEngine/Tween.h
vendored
@ -1,116 +0,0 @@
|
||||
//
|
||||
// Tween.h
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#ifndef __Tween__
|
||||
#define __Tween__
|
||||
|
||||
#include <TweenEngine/Tweenable.h>
|
||||
#include <TweenEngine/BaseTween.h>
|
||||
#include <TweenEngine/Pool.h>
|
||||
#include <TweenEngine/TweenEquation.h>
|
||||
#include <TweenEngine/TweenPath.h>
|
||||
#include <TweenEngine/TweenEquations.h>
|
||||
#include <TweenEngine/TweenPaths.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
class TweenPool;
|
||||
class TweenPoolCallback;
|
||||
|
||||
class Tween : public BaseTween
|
||||
{
|
||||
friend class TweenPoolCallback;
|
||||
|
||||
private:
|
||||
static int combinedAttrsLimit;
|
||||
static int waypointsLimit;
|
||||
|
||||
// Main
|
||||
Tweenable *targetObj;
|
||||
int type;
|
||||
TweenEquation *equation;
|
||||
TweenPath *pathAlgorithm;
|
||||
|
||||
// General
|
||||
bool isFrom;
|
||||
bool isRelative;
|
||||
int combinedAttrsCnt;
|
||||
int waypointsCnt;
|
||||
|
||||
// Values
|
||||
float* startValues;
|
||||
float* targetValues;
|
||||
float* waypoints;
|
||||
|
||||
// Buffers
|
||||
float *accessorBuffer;
|
||||
int accessorBufferSize;
|
||||
float *pathBuffer;
|
||||
int pathBufferSize;
|
||||
|
||||
//static TweenPoolCallback *poolCallback;
|
||||
static TweenPool &pool;
|
||||
|
||||
void setup(Tweenable *target, int tweenType, float duration);
|
||||
|
||||
protected:
|
||||
virtual void reset();
|
||||
virtual void forceStartValues();
|
||||
virtual void forceEndValues();
|
||||
virtual void initializeOverride();
|
||||
virtual void updateOverride(int step, int lastStep, bool isIterationStep, float delta);
|
||||
|
||||
public:
|
||||
static const int ACCESSOR_READ = 0;
|
||||
static const int ACCESSOR_WRITE = 1;
|
||||
|
||||
static void setCombinedAttributesLimit(int limit);
|
||||
static void setWaypointsLimit(int limit);
|
||||
static const char *getVersion();
|
||||
|
||||
static int getPoolSize();
|
||||
static void ensurePoolCapacity(int minCapacity);
|
||||
|
||||
static Tween &to(Tweenable& target, int tweenType, float duration);
|
||||
static Tween &from(Tweenable& target, int tweenType, float duration);
|
||||
static Tween &set(Tweenable& target, int tweenType);
|
||||
static Tween &call(TweenCallback &callback);
|
||||
static Tween &mark();
|
||||
|
||||
Tween();
|
||||
~Tween();
|
||||
|
||||
virtual int getTweenCount();
|
||||
virtual int getTimelineCount();
|
||||
|
||||
virtual Tween &build();
|
||||
virtual void free();
|
||||
|
||||
Tween &ease(TweenEquation &easeEquation);
|
||||
Tween &target(float targetValue);
|
||||
Tween &target(float targetValue1, float targetValue2);
|
||||
Tween &target(float targetValue1, float targetValue2, float targetValue3);
|
||||
Tween &target(float *targetValues, int len);
|
||||
Tween &targetRelative(float targetValue);
|
||||
Tween &targetRelative(float targetValue1, float targetValue2);
|
||||
Tween &targetRelative(float targetValue1, float targetValue2, float targetValue3);
|
||||
Tween &targetRelative(float *targetValues, int len);
|
||||
Tween &waypoint(float targetValue);
|
||||
Tween &waypoint(float targetValue1, float targetValue2);
|
||||
Tween &waypoint(float targetValue1, float targetValue2, float targetValue3);
|
||||
Tween &waypoint(float *targetValues, int len);
|
||||
Tween &path(TweenPath &path);
|
||||
int getType();
|
||||
TweenEquation *getEasing();
|
||||
float *getTargetValues();
|
||||
int getCombinedAttributesCount();
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* defined(__Tween__) */
|
@ -1,103 +0,0 @@
|
||||
//
|
||||
// TweenAccessor.h
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
/**
|
||||
* The TweenAccessor interface lets you interpolate any attribute from any
|
||||
* object. Just implement it as you want and register it to the engine by
|
||||
* calling {@link Tween#registerAccessor}.
|
||||
* <p/>
|
||||
*
|
||||
* <h2>Example</h2>
|
||||
*
|
||||
* The following code snippet presents an example of implementation for tweening
|
||||
* a Particle class. This Particle class is supposed to only define a position
|
||||
* with an "x" and an "y" fields, and their associated getters and setters.
|
||||
* <p/>
|
||||
*
|
||||
* <pre> {@code
|
||||
* public class ParticleAccessor implements TweenAccessor<Particle> {
|
||||
* public static final int X = 1;
|
||||
* public static final int Y = 2;
|
||||
* public static final int XY = 3;
|
||||
*
|
||||
* public int getValues(Particle target, int tweenType, float[] returnValues) {
|
||||
* switch (tweenType) {
|
||||
* case X: returnValues[0] = target.getX(); return 1;
|
||||
* case Y: returnValues[0] = target.getY(); return 1;
|
||||
* case XY:
|
||||
* returnValues[0] = target.getX();
|
||||
* returnValues[1] = target.getY();
|
||||
* return 2;
|
||||
* default: assert false; return 0;
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* public void setValues(Particle target, int tweenType, float[] newValues) {
|
||||
* switch (tweenType) {
|
||||
* case X: target.setX(newValues[0]); break;
|
||||
* case Y: target.setY(newValues[1]); break;
|
||||
* case XY:
|
||||
* target.setX(newValues[0]);
|
||||
* target.setY(newValues[1]);
|
||||
* break;
|
||||
* default: assert false; break;
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* }</pre>
|
||||
*
|
||||
* Once done, you only need to register this TweenAccessor once to be able to
|
||||
* use it for every Particle objects in your application:
|
||||
* <p/>
|
||||
*
|
||||
* <pre> {@code
|
||||
* Tween.registerAccessor(Particle.class, new ParticleAccessor());
|
||||
* }</pre>
|
||||
*
|
||||
* And that's all, the Tween Engine can no work with all your particles!
|
||||
*
|
||||
* @author Aurelien Ribon | http://www.aurelienribon.com/
|
||||
*/
|
||||
|
||||
#ifndef __TweenAccessor__
|
||||
#define __TweenAccessor__
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
template<class T>
|
||||
class TweenAccessor
|
||||
{
|
||||
|
||||
public:
|
||||
virtual ~TweenAccessor() {}
|
||||
|
||||
/**
|
||||
* Gets one or many values from the target object associated to the
|
||||
* given tween type. It is used by the Tween Engine to determine starting
|
||||
* values.
|
||||
*
|
||||
* @param target The target object of the tween.
|
||||
* @param tweenType An integer representing the tween type.
|
||||
* @param returnValues An array which should be modified by this method.
|
||||
* @return The count of modified slots from the returnValues array.
|
||||
*/
|
||||
virtual int getValues(T& target, int tweenType, float *returnValues) = 0;
|
||||
|
||||
/**
|
||||
* This method is called by the Tween Engine each time a running tween
|
||||
* associated with the current target object has been updated.
|
||||
*
|
||||
* @param target The target object of the tween.
|
||||
* @param tweenType An integer representing the tween type.
|
||||
* @param newValues The new values determined by the Tween Engine.
|
||||
*/
|
||||
virtual void setValues(T& target, int tweenType, float *newValues) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* defined(__TweenAccessor__) */
|
@ -1,65 +0,0 @@
|
||||
//
|
||||
// TweenCallback.h
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
/**
|
||||
* TweenCallbacks are used to trigger actions at some specific times. They are
|
||||
* used in both Tweens and Timelines. The moment when the callback is
|
||||
* triggered depends on its registered triggers:
|
||||
* <p/>
|
||||
*
|
||||
* <b>BEGIN</b>: right after the delay (if any)<br/>
|
||||
* <b>START</b>: at each iteration beginning<br/>
|
||||
* <b>END</b>: at each iteration ending, before the repeat delay<br/>
|
||||
* <b>COMPLETE</b>: at last END event<br/>
|
||||
* <b>BACK_BEGIN</b>: at the beginning of the first backward iteration<br/>
|
||||
* <b>BACK_START</b>: at each backward iteration beginning, after the repeat delay<br/>
|
||||
* <b>BACK_END</b>: at each backward iteration ending<br/>
|
||||
* <b>BACK_COMPLETE</b>: at last BACK_END event
|
||||
* <p/>
|
||||
*
|
||||
* <pre> {@code
|
||||
* forward : BEGIN COMPLETE
|
||||
* forward : START END START END START END
|
||||
* |--------------[XXXXXXXXXX]------[XXXXXXXXXX]------[XXXXXXXXXX]
|
||||
* backward: bEND bSTART bEND bSTART bEND bSTART
|
||||
* backward: bCOMPLETE bBEGIN
|
||||
* }</pre>
|
||||
*
|
||||
* @see Tween
|
||||
* @see Timeline
|
||||
* @author Aurelien Ribon | http://www.aurelienribon.com/
|
||||
*/
|
||||
|
||||
#ifndef __TweenCallback__
|
||||
#define __TweenCallback__
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
class BaseTween;
|
||||
|
||||
class TweenCallback
|
||||
{
|
||||
|
||||
public:
|
||||
static const int BEGIN = 0x01;
|
||||
static const int START = 0x02;
|
||||
static const int END = 0x04;
|
||||
static const int COMPLETE = 0x08;
|
||||
static const int BACK_BEGIN = 0x10;
|
||||
static const int BACK_START = 0x20;
|
||||
static const int BACK_END = 0x40;
|
||||
static const int BACK_COMPLETE = 0x80;
|
||||
static const int ANY_FORWARD = 0x0F;
|
||||
static const int ANY_BACKWARD = 0xF0;
|
||||
static const int ANY = 0xFF;
|
||||
|
||||
virtual ~TweenCallback() {}
|
||||
virtual void onEvent(int type, BaseTween *source) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
#endif /* defined(__TweenCallback__) */
|
@ -1,46 +0,0 @@
|
||||
//
|
||||
// TweenEquation.h
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
/**
|
||||
* Base class for every easing equation. You can create your own equations
|
||||
* and directly use them in the Tween engine by inheriting from this class.
|
||||
*
|
||||
* @see Tween
|
||||
* @author Aurelien Ribon | http://www.aurelienribon.com/
|
||||
*/
|
||||
|
||||
#ifndef __TweenEquation__
|
||||
#define __TweenEquation__
|
||||
|
||||
//#include <string.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
class TweenEquation
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Computes the next value of the interpolation.
|
||||
*
|
||||
* @param t The current time, between 0 and 1.
|
||||
* @return The current value.
|
||||
*/
|
||||
virtual float compute(float t) = 0;
|
||||
|
||||
virtual const char *toString() = 0;
|
||||
|
||||
/**
|
||||
* Returns true if the given string is the name of this equation (the name
|
||||
* is returned in the toString() method, don't forget to override it).
|
||||
* This method is usually used to save/load a tween to/from a text file.
|
||||
*/
|
||||
//bool isValueOf(const char *str) { return !strcmp(str, toString()); };
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* defined(__TweenEquation__) */
|
@ -1,63 +0,0 @@
|
||||
//
|
||||
// TweenEquations.h
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#ifndef __TweenEquations__
|
||||
#define __TweenEquations__
|
||||
|
||||
#include <TweenEngine/equations/Quad.h>
|
||||
#include <TweenEngine/equations/Linear.h>
|
||||
#include <TweenEngine/equations/Back.h>
|
||||
#include <TweenEngine/equations/Bounce.h>
|
||||
#include <TweenEngine/equations/Circ.h>
|
||||
#include <TweenEngine/equations/Cubic.h>
|
||||
#include <TweenEngine/equations/Elastic.h>
|
||||
#include <TweenEngine/equations/Expo.h>
|
||||
#include <TweenEngine/equations/Quart.h>
|
||||
#include <TweenEngine/equations/Quint.h>
|
||||
#include <TweenEngine/equations/Sine.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
class TweenEquations
|
||||
{
|
||||
public:
|
||||
static TweenEquation &easeInQuad;
|
||||
static TweenEquation &easeOutQuad;
|
||||
static TweenEquation &easeInOutQuad;
|
||||
static TweenEquation &easeInOutLinear;
|
||||
static TweenEquation &easeInBack;
|
||||
static TweenEquation &easeOutBack;
|
||||
static TweenEquation &easeInOutBack;
|
||||
static TweenEquation &easeInBounce;
|
||||
static TweenEquation &easeOutBounce;
|
||||
static TweenEquation &easeInOutBounce;
|
||||
static TweenEquation &easeInCirc;
|
||||
static TweenEquation &easeOutCirc;
|
||||
static TweenEquation &easeInOutCirc;
|
||||
static TweenEquation &easeInCubic;
|
||||
static TweenEquation &easeOutCubic;
|
||||
static TweenEquation &easeInOutCubic;
|
||||
static TweenEquation &easeInElastic;
|
||||
static TweenEquation &easeOutElastic;
|
||||
static TweenEquation &easeInOutElastic;
|
||||
static TweenEquation &easeInExpo;
|
||||
static TweenEquation &easeOutExpo;
|
||||
static TweenEquation &easeInOutExpo;
|
||||
static TweenEquation &easeInQuart;
|
||||
static TweenEquation &easeOutQuart;
|
||||
static TweenEquation &easeInOutQuart;
|
||||
static TweenEquation &easeInQuint;
|
||||
static TweenEquation &easeOutQuint;
|
||||
static TweenEquation &easeInOutQuint;
|
||||
static TweenEquation &easeInSine;
|
||||
static TweenEquation &easeOutSine;
|
||||
static TweenEquation &easeInOutSine;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* defined(__TweenEquations__) */
|
@ -1,61 +0,0 @@
|
||||
//
|
||||
// TweenManager.h
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
/**
|
||||
* A TweenManager updates all your tweens and timelines at once.
|
||||
* Its main interest is that it handles the tween/timeline life-cycles for you,
|
||||
* as well as the pooling constraints (if object pooling is enabled).
|
||||
* <p/>
|
||||
*
|
||||
* Just give it a bunch of tweens or timelines and call update() periodically,
|
||||
* you don't need to care for anything else! Relax and enjoy your animations.
|
||||
*
|
||||
* @see Tween
|
||||
* @see Timeline
|
||||
* @author Aurelien Ribon | http://www.aurelienribon.com/
|
||||
*/
|
||||
|
||||
#ifndef __TweenManager__
|
||||
#define __TweenManager__
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
#include <TweenEngine/BaseTween.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
class TweenManager
|
||||
{
|
||||
private:
|
||||
std::vector<BaseTween *>objects;
|
||||
|
||||
bool isPaused = false;
|
||||
|
||||
public:
|
||||
TweenManager();
|
||||
|
||||
static void setAutoRemove(BaseTween &object, bool value);
|
||||
static void setAutoStart(BaseTween &object, bool value);
|
||||
|
||||
TweenManager &add(BaseTween &object);
|
||||
void killAll();
|
||||
void ensureCapacity(int minCapacity);
|
||||
void pause();
|
||||
void resume();
|
||||
void update(float delta);
|
||||
int size();
|
||||
|
||||
// Debug Helpers
|
||||
int getRunningTweensCount();
|
||||
int getRunningTimelinesCount();
|
||||
std::vector<BaseTween *> &getObjects();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* defined(__TweenManager__) */
|
@ -1,37 +0,0 @@
|
||||
//
|
||||
// TweenPath.h
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
/**
|
||||
* Base class for every paths. You can create your own paths and directly use
|
||||
* them in the Tween engine by inheriting from this class.
|
||||
*
|
||||
* @author Aurelien Ribon | http://www.aurelienribon.com/
|
||||
*/
|
||||
|
||||
#ifndef __TweenPath__
|
||||
#define __TweenPath__
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
class TweenPath
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Computes the next value of the interpolation, based on its waypoints and
|
||||
* the current progress.
|
||||
*
|
||||
* @param t The progress of the interpolation, between 0 and 1. May be out
|
||||
* of these bounds if the easing equation involves some kind of rebounds.
|
||||
* @param points The waypoints of the tween, from start to target values.
|
||||
* @param pointsCnt The number of valid points in the array.
|
||||
* @return The next value of the interpolation.
|
||||
*/
|
||||
virtual float compute(float t, float *points, int pointsCnt) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* defined(__TweenPath__) */
|
@ -1,23 +0,0 @@
|
||||
//
|
||||
// TweenPaths.h
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#ifndef __TweenPaths__
|
||||
#define __TweenPaths__
|
||||
|
||||
#include <TweenEngine/TweenPath.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
class TweenPaths
|
||||
{
|
||||
public:
|
||||
static TweenPath &linear;
|
||||
static TweenPath &catmullRom;
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* defined(__TweenPaths__) */
|
@ -1,32 +0,0 @@
|
||||
//
|
||||
// TweenPool.h
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#ifndef __TweenPool__
|
||||
#define __TweenPool__
|
||||
|
||||
#include <TweenEngine/Pool.h>
|
||||
#include <TweenEngine/Tween.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
class TweenPoolCallback : public PoolCallback<Tween>
|
||||
{
|
||||
public:
|
||||
void onPool(Tween *obj);
|
||||
void onUnPool(Tween *obj);
|
||||
};
|
||||
|
||||
class TweenPool : public Pool<Tween>
|
||||
{
|
||||
protected:
|
||||
Tween *create();
|
||||
public:
|
||||
TweenPool();
|
||||
|
||||
};
|
||||
}
|
||||
#endif /* defined(__TweenPool__) */
|
@ -1,12 +0,0 @@
|
||||
#ifndef __Tweenable__
|
||||
#define __Tweenable__
|
||||
|
||||
namespace TweenEngine {
|
||||
class Tweenable {
|
||||
public:
|
||||
virtual int getValues(int tweenType, float *returnValues) = 0;
|
||||
virtual void setValues(int tweenType, float *newValues) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -1,37 +0,0 @@
|
||||
//
|
||||
// Back.h
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#ifndef __Back__
|
||||
#define __Back__
|
||||
|
||||
#include <TweenEngine/TweenEquation.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
class BackIn : public TweenEquation
|
||||
{
|
||||
~BackIn();
|
||||
float compute(float t);
|
||||
const char *toString();
|
||||
};
|
||||
|
||||
class BackOut : public TweenEquation
|
||||
{
|
||||
~BackOut();
|
||||
float compute(float t);
|
||||
const char *toString();
|
||||
};
|
||||
|
||||
class BackInOut : public TweenEquation
|
||||
{
|
||||
~BackInOut();
|
||||
float compute(float t);
|
||||
const char *toString();
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* defined(__Back__) */
|
@ -1,38 +0,0 @@
|
||||
//
|
||||
// Bounce.h
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#ifndef __Bounce__
|
||||
#define __Bounce__
|
||||
|
||||
#include <TweenEngine/TweenEquation.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
class BounceIn : public TweenEquation
|
||||
{
|
||||
~BounceIn();
|
||||
float compute(float t);
|
||||
const char *toString();
|
||||
};
|
||||
|
||||
class BounceOut : public TweenEquation
|
||||
{
|
||||
~BounceOut();
|
||||
float compute(float t);
|
||||
const char *toString();
|
||||
};
|
||||
|
||||
class BounceInOut : public TweenEquation
|
||||
{
|
||||
~BounceInOut();
|
||||
float compute(float t);
|
||||
const char *toString();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif /* defined(__Bounce__) */
|
@ -1,37 +0,0 @@
|
||||
//
|
||||
// Circ.h
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#ifndef __Circ__
|
||||
#define __Circ__
|
||||
|
||||
#include <TweenEngine/TweenEquation.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
class CircIn : public TweenEquation
|
||||
{
|
||||
~CircIn();
|
||||
float compute(float t);
|
||||
const char *toString();
|
||||
};
|
||||
|
||||
class CircOut : public TweenEquation
|
||||
{
|
||||
~CircOut();
|
||||
float compute(float t);
|
||||
const char *toString();
|
||||
};
|
||||
|
||||
class CircInOut : public TweenEquation
|
||||
{
|
||||
~CircInOut();
|
||||
float compute(float t);
|
||||
const char *toString();
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* defined(__Circ__) */
|
@ -1,37 +0,0 @@
|
||||
//
|
||||
// Cubic.h
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#ifndef __Cubic__
|
||||
#define __Cubic__
|
||||
|
||||
#include <TweenEngine/TweenEquation.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
class CubicIn : public TweenEquation
|
||||
{
|
||||
~CubicIn();
|
||||
float compute(float t);
|
||||
const char *toString();
|
||||
};
|
||||
|
||||
class CubicOut : public TweenEquation
|
||||
{
|
||||
~CubicOut();
|
||||
float compute(float t);
|
||||
const char *toString();
|
||||
};
|
||||
|
||||
class CubicInOut : public TweenEquation
|
||||
{
|
||||
~CubicInOut();
|
||||
float compute(float t);
|
||||
const char *toString();
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* defined(__Cubic__) */
|
@ -1,61 +0,0 @@
|
||||
//
|
||||
// Elastic.h
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#ifndef __Elastic__
|
||||
#define __Elastic__
|
||||
|
||||
#include <TweenEngine/TweenEquation.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
class ElasticIn : public TweenEquation
|
||||
{
|
||||
private:
|
||||
float amplitude;
|
||||
float period;
|
||||
bool isAmplitudeSet;
|
||||
bool isPeriodSet;
|
||||
public:
|
||||
~ElasticIn();
|
||||
float compute(float t);
|
||||
const char *toString();
|
||||
void setAmplitude(float a);
|
||||
void setPeriod(float p);
|
||||
};
|
||||
|
||||
class ElasticOut : public TweenEquation
|
||||
{
|
||||
private:
|
||||
float amplitude;
|
||||
float period;
|
||||
bool isAmplitudeSet;
|
||||
bool isPeriodSet;
|
||||
public:
|
||||
~ElasticOut();
|
||||
float compute(float t);
|
||||
const char *toString();
|
||||
void setAmplitude(float a);
|
||||
void setPeriod(float p);
|
||||
};
|
||||
|
||||
class ElasticInOut : public TweenEquation
|
||||
{
|
||||
private:
|
||||
float amplitude;
|
||||
float period;
|
||||
bool isAmplitudeSet;
|
||||
bool isPeriodSet;
|
||||
public:
|
||||
~ElasticInOut();
|
||||
float compute(float t);
|
||||
const char *toString();
|
||||
void setAmplitude(float a);
|
||||
void setPeriod(float p);
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* defined(__Elastic__) */
|
@ -1,37 +0,0 @@
|
||||
//
|
||||
// Expo.h
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#ifndef __Expo__
|
||||
#define __Expo__
|
||||
|
||||
#include <TweenEngine/TweenEquation.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
class ExpoIn : public TweenEquation
|
||||
{
|
||||
~ExpoIn();
|
||||
float compute(float t);
|
||||
const char *toString();
|
||||
};
|
||||
|
||||
class ExpoOut : public TweenEquation
|
||||
{
|
||||
~ExpoOut();
|
||||
float compute(float t);
|
||||
const char *toString();
|
||||
};
|
||||
|
||||
class ExpoInOut : public TweenEquation
|
||||
{
|
||||
~ExpoInOut();
|
||||
float compute(float t);
|
||||
const char *toString();
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* defined(__Expo__) */
|
@ -1,24 +0,0 @@
|
||||
//
|
||||
// Linear.h
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#ifndef __Linear__
|
||||
#define __Linear__
|
||||
|
||||
#include <TweenEngine/TweenEquation.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
class LinearInOut : public TweenEquation
|
||||
{
|
||||
~LinearInOut();
|
||||
float compute(float t);
|
||||
const char *toString();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif /* defined(__Linear__) */
|
@ -1,37 +0,0 @@
|
||||
//
|
||||
// Quad.h
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#ifndef __Quad__
|
||||
#define __Quad__
|
||||
|
||||
#include <TweenEngine/TweenEquation.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
class QuadIn : public TweenEquation
|
||||
{
|
||||
~QuadIn();
|
||||
float compute(float t);
|
||||
const char *toString();
|
||||
};
|
||||
|
||||
class QuadOut : public TweenEquation
|
||||
{
|
||||
~QuadOut();
|
||||
float compute(float t);
|
||||
const char *toString();
|
||||
};
|
||||
|
||||
class QuadInOut : public TweenEquation
|
||||
{
|
||||
~QuadInOut();
|
||||
float compute(float t);
|
||||
const char *toString();
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* defined(__Quad__) */
|
@ -1,37 +0,0 @@
|
||||
//
|
||||
// Quart.h
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#ifndef __Quart__
|
||||
#define __Quart__
|
||||
|
||||
#include <TweenEngine/TweenEquation.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
class QuartIn : public TweenEquation
|
||||
{
|
||||
~QuartIn();
|
||||
float compute(float t);
|
||||
const char *toString();
|
||||
};
|
||||
|
||||
class QuartOut : public TweenEquation
|
||||
{
|
||||
~QuartOut();
|
||||
float compute(float t);
|
||||
const char *toString();
|
||||
};
|
||||
|
||||
class QuartInOut : public TweenEquation
|
||||
{
|
||||
~QuartInOut();
|
||||
float compute(float t);
|
||||
const char *toString();
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* defined(__Quart__) */
|
@ -1,37 +0,0 @@
|
||||
//
|
||||
// Quint.h
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#ifndef __Quint__
|
||||
#define __Quint__
|
||||
|
||||
#include <TweenEngine/TweenEquation.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
class QuintIn : public TweenEquation
|
||||
{
|
||||
~QuintIn();
|
||||
float compute(float t);
|
||||
const char *toString();
|
||||
};
|
||||
|
||||
class QuintOut : public TweenEquation
|
||||
{
|
||||
~QuintOut();
|
||||
float compute(float t);
|
||||
const char *toString();
|
||||
};
|
||||
|
||||
class QuintInOut : public TweenEquation
|
||||
{
|
||||
~QuintInOut();
|
||||
float compute(float t);
|
||||
const char *toString();
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* defined(__Quint__) */
|
@ -1,37 +0,0 @@
|
||||
//
|
||||
// Sine.h
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#ifndef __Sine__
|
||||
#define __Sine__
|
||||
|
||||
#include <TweenEngine/TweenEquation.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
class SineIn : public TweenEquation
|
||||
{
|
||||
~SineIn();
|
||||
float compute(float t);
|
||||
const char *toString();
|
||||
};
|
||||
|
||||
class SineOut : public TweenEquation
|
||||
{
|
||||
~SineOut();
|
||||
float compute(float t);
|
||||
const char *toString();
|
||||
};
|
||||
|
||||
class SineInOut : public TweenEquation
|
||||
{
|
||||
~SineInOut();
|
||||
float compute(float t);
|
||||
const char *toString();
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* defined(__Sine__) */
|
@ -1,22 +0,0 @@
|
||||
//
|
||||
// CatmullRom.h
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#ifndef __CatmullRom__
|
||||
#define __CatmullRom__
|
||||
|
||||
#include <TweenEngine/TweenPath.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
class CatmullRom : public TweenPath
|
||||
{
|
||||
float compute(float t, float *points, int pointsCnt);
|
||||
float catmullRomSpline(float a, float b, float c, float d, float t);
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* defined(__CatmullRom__) */
|
@ -1,21 +0,0 @@
|
||||
//
|
||||
// Linear.h
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#ifndef __LinearPath__
|
||||
#define __LinearPath__
|
||||
|
||||
#include <TweenEngine/TweenPath.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
class LinearPath : public TweenPath
|
||||
{
|
||||
float compute(float t, float *points, int pointsCnt);
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* defined(__LinearPath__) */
|
BIN
external/tween-engine/lib/libtween.a
vendored
BIN
external/tween-engine/lib/libtween.a
vendored
Binary file not shown.
525
external/tween-engine/src/BaseTween.cpp
vendored
525
external/tween-engine/src/BaseTween.cpp
vendored
@ -1,525 +0,0 @@
|
||||
//
|
||||
// BaseTween.cpp
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
//#define NDEBUG
|
||||
|
||||
#include <TweenEngine/BaseTween.h>
|
||||
#include <TweenEngine/TweenManager.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
void BaseTween::reset()
|
||||
{
|
||||
step = -2;
|
||||
repeatCnt = 0;
|
||||
isIterationStep = isYoyoFlag = false;
|
||||
|
||||
delayStart = duration = repeatDelay = currentTime = deltaTime = 0;
|
||||
isStartedFlag = isInitializedFlag = isFinishedFlag = isKilledFlag = isPausedFlag = false;
|
||||
|
||||
callback = nullptr;
|
||||
callbackTriggers = TweenCallback::COMPLETE;
|
||||
userData = nullptr;
|
||||
callbacks.clear();
|
||||
|
||||
isAutoRemoveEnabled = isAutoStartEnabled = true;
|
||||
}
|
||||
|
||||
// API
|
||||
|
||||
/**
|
||||
* Builds and validates the object. Only needed if you want to finalize a
|
||||
* tween or timeline without starting it, since a call to ".start()" also
|
||||
* calls this method.
|
||||
*
|
||||
* @return The current object, for chaining instructions.
|
||||
*/
|
||||
BaseTween &BaseTween::build()
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts or restarts the object unmanaged. You will need to take care of
|
||||
* its life-cycle. If you want the tween to be managed for you, use a
|
||||
* {@link TweenManager}.
|
||||
*
|
||||
* @return The current object, for chaining instructions.
|
||||
*/
|
||||
BaseTween &BaseTween::start()
|
||||
{
|
||||
build();
|
||||
currentTime = 0;
|
||||
isStartedFlag = true;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to add an object to a manager. Its life-cycle will be
|
||||
* handled for you. Relax and enjoy the animation.
|
||||
*
|
||||
* @return The current object, for chaining instructions.
|
||||
*/
|
||||
BaseTween &BaseTween::start(TweenManager &manager) {
|
||||
manager.add(*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a delay to the tween or timeline.
|
||||
*
|
||||
* @param delay A duration.
|
||||
* @return The current object, for chaining instructions.
|
||||
*/
|
||||
BaseTween &BaseTween::delay(float delay)
|
||||
{
|
||||
this->delayStart += delay;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Kills the tween or timeline. If you are using a TweenManager, this object
|
||||
* will be removed automatically.
|
||||
*/
|
||||
void BaseTween::kill()
|
||||
{
|
||||
isKilledFlag = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops and resets the tween or timeline, and sends it to its pool, for
|
||||
+ * later reuse. Note that if you use a {@link TweenManager}, this method
|
||||
+ * is automatically called once the animation is finished.
|
||||
*/
|
||||
void BaseTween::free()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Pauses the tween or timeline. Further update calls won't have any effect.
|
||||
*/
|
||||
void BaseTween::pause()
|
||||
{
|
||||
isPausedFlag = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resumes the tween or timeline. Has no effect is it was no already paused.
|
||||
*/
|
||||
void BaseTween::resume()
|
||||
{
|
||||
isPausedFlag = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Repeats the tween or timeline for a given number of times.
|
||||
* @param count The number of repetitions. For infinite repetition,
|
||||
* use Tween.INFINITY, or a negative number.
|
||||
*
|
||||
* @param delay A delay between each iteration.
|
||||
* @return The current tween or timeline, for chaining instructions.
|
||||
*/
|
||||
BaseTween &BaseTween::repeat(int count, float delay)
|
||||
{
|
||||
if (isStartedFlag)
|
||||
{
|
||||
//throw new RuntimeException("You can't change the repetitions of a tween or timeline once it is started");
|
||||
}
|
||||
else
|
||||
{
|
||||
repeatCnt = count;
|
||||
repeatDelay = delay >= 0 ? delay : 0;
|
||||
isYoyoFlag = false;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Repeats the tween or timeline for a given number of times.
|
||||
* Every two iterations, it will be played backwards.
|
||||
*
|
||||
* @param count The number of repetitions. For infinite repetition,
|
||||
* use Tween.INFINITY, or '-1'.
|
||||
* @param delay A delay before each repetition.
|
||||
* @return The current tween or timeline, for chaining instructions.
|
||||
*/
|
||||
BaseTween &BaseTween::repeatYoyo(int count, float delay)
|
||||
{
|
||||
if (isStartedFlag)
|
||||
{
|
||||
//throw new RuntimeException("You can't change the repetitions of a tween or timeline once it is started");
|
||||
}
|
||||
else
|
||||
{
|
||||
repeatCnt = count;
|
||||
repeatDelay = delay >= 0 ? delay : 0;
|
||||
isYoyoFlag = true;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the callback. By default, it will be fired at the completion of the
|
||||
* tween or timeline (event COMPLETE). If you want to change this behavior
|
||||
* and add more triggers, use the {@link setCallbackTriggers()} method.
|
||||
*
|
||||
* @see TweenCallback
|
||||
*/
|
||||
BaseTween &BaseTween::setCallback(TweenCallback *callback)
|
||||
{
|
||||
this->callback = callback;
|
||||
return *this;
|
||||
}
|
||||
|
||||
BaseTween &BaseTween::setCallback(int type, const TweenCallbackFunction& callback)
|
||||
{
|
||||
callbacks[type] = callback;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the triggers of the callback. The available triggers, listed as
|
||||
* members of the {@link TweenCallback} interface, are:
|
||||
* <p/>
|
||||
*
|
||||
* <b>BEGIN</b>: right after the delay (if any)<br/>
|
||||
* <b>START</b>: at each iteration beginning<br/>
|
||||
* <b>END</b>: at each iteration ending, before the repeat delay<br/>
|
||||
* <b>COMPLETE</b>: at last END event<br/>
|
||||
* <b>BACK_BEGIN</b>: at the beginning of the first backward iteration<br/>
|
||||
* <b>BACK_START</b>: at each backward iteration beginning, after the repeat delay<br/>
|
||||
* <b>BACK_END</b>: at each backward iteration ending<br/>
|
||||
* <b>BACK_COMPLETE</b>: at last BACK_END event
|
||||
* <p/>
|
||||
*
|
||||
* <pre> {@code
|
||||
* forward : BEGIN COMPLETE
|
||||
* forward : START END START END START END
|
||||
* |--------------[XXXXXXXXXX]------[XXXXXXXXXX]------[XXXXXXXXXX]
|
||||
* backward: bEND bSTART bEND bSTART bEND bSTART
|
||||
* backward: bCOMPLETE bBEGIN
|
||||
* }</pre>
|
||||
*
|
||||
* @param flags one or more triggers, separated by the '|' operator.
|
||||
* @see TweenCallback
|
||||
*/
|
||||
BaseTween &BaseTween::setCallbackTriggers(int flags)
|
||||
{
|
||||
this->callbackTriggers = flags;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attaches an object to this tween or timeline. It can be useful in order
|
||||
* to retrieve some data from a TweenCallback.
|
||||
*
|
||||
* @param data Any kind of object.
|
||||
* @return The current tween or timeline, for chaining instructions.
|
||||
*/
|
||||
BaseTween &BaseTween::setUserData(void *data)
|
||||
{
|
||||
userData = data;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Getters
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Gets the delay of the tween or timeline. Nothing will happen before
|
||||
* this delay.
|
||||
*/
|
||||
float BaseTween::getDelay() { return delayStart; }
|
||||
|
||||
/**
|
||||
* Gets the duration of a single iteration.
|
||||
*/
|
||||
float BaseTween::getDuration() { return duration; }
|
||||
|
||||
/**
|
||||
* Gets the number of iterations that will be played.
|
||||
*/
|
||||
int BaseTween::getRepeatCount() { return repeatCnt; }
|
||||
|
||||
/**
|
||||
* Gets the delay occuring between two iterations.
|
||||
*/
|
||||
float BaseTween::getRepeatDelay() { return repeatDelay; }
|
||||
|
||||
/**
|
||||
* Returns the complete duration, including initial delay and repetitions.
|
||||
* The formula is as follows:
|
||||
* <pre>
|
||||
* fullDuration = delay + duration + (repeatDelay + duration) * repeatCnt
|
||||
* </pre>
|
||||
*/
|
||||
float BaseTween::getFullDuration()
|
||||
{
|
||||
if (repeatCnt < 0) return -1;
|
||||
return delayStart + duration + (repeatDelay + duration) * repeatCnt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the attached data, or null if none.
|
||||
*/
|
||||
void *BaseTween::getUserData() { return userData; }
|
||||
|
||||
/**
|
||||
* Gets the id of the current step. Values are as follows:<br/>
|
||||
* <ul>
|
||||
* <li>even numbers mean that an iteration is playing,<br/>
|
||||
* <li>odd numbers mean that we are between two iterations,<br/>
|
||||
* <li>-2 means that the initial delay has not ended,<br/>
|
||||
* <li>-1 means that we are before the first iteration,<br/>
|
||||
* <li>repeatCount*2 + 1 means that we are after the last iteration
|
||||
*/
|
||||
int BaseTween::getStep() { return step; }
|
||||
|
||||
/**
|
||||
* Gets the local time.
|
||||
*/
|
||||
float BaseTween::getCurrentTime() { return currentTime; }
|
||||
|
||||
/**
|
||||
* Returns true if the tween or timeline has been started.
|
||||
*/
|
||||
bool BaseTween::isStarted() { return isStartedFlag; }
|
||||
|
||||
/**
|
||||
* Returns true if the tween or timeline has been initialized. Starting
|
||||
* values for tweens are stored at initialization time. This initialization
|
||||
* takes place right after the initial delay, if any.
|
||||
*/
|
||||
bool BaseTween::isInitialized() { return isInitializedFlag; }
|
||||
|
||||
/**
|
||||
* Returns true if the tween is finished (i.e. if the tween has reached
|
||||
* its end or has been killed). If you don't use a TweenManager, you may
|
||||
* want to call {@link free()} to reuse the object later.
|
||||
*/
|
||||
bool BaseTween::isFinished() { return isFinishedFlag || isKilledFlag; }
|
||||
|
||||
/**
|
||||
* Returns true if the iterations are played as yoyo. Yoyo means that
|
||||
* every two iterations, the animation will be played backwards.
|
||||
*/
|
||||
bool BaseTween::isYoyo() { return isYoyoFlag; }
|
||||
|
||||
/**
|
||||
* Returns true if the tween or timeline is currently paused.
|
||||
*/
|
||||
bool BaseTween::isPaused() { return isPausedFlag; }
|
||||
|
||||
void BaseTween::initializeOverride() {}
|
||||
|
||||
void BaseTween::updateOverride(int step, int lastStep, bool isIterationStep, float delta) {}
|
||||
|
||||
void BaseTween::forceToStart()
|
||||
{
|
||||
currentTime = -delayStart;
|
||||
step = -1;
|
||||
isIterationStep = false;
|
||||
if (isReverse(0)) forceEndValues();
|
||||
else forceStartValues();
|
||||
}
|
||||
|
||||
void BaseTween::forceToEnd(float time)
|
||||
{
|
||||
currentTime = time - getFullDuration();
|
||||
step = repeatCnt*2 + 1;
|
||||
isIterationStep = false;
|
||||
if (isReverse(repeatCnt*2)) forceStartValues();
|
||||
else forceEndValues();
|
||||
}
|
||||
|
||||
void BaseTween::callCallback(int type)
|
||||
{
|
||||
auto callback = callbacks.find(type);
|
||||
if (callback != callbacks.end()) {
|
||||
callback->second(this);
|
||||
}
|
||||
// if (callback != nullptr && (callbackTriggers & type) > 0) callback->onEvent(type, this);
|
||||
}
|
||||
|
||||
bool BaseTween::isReverse(int step)
|
||||
{
|
||||
return isYoyoFlag && abs(step%4) == 2;
|
||||
}
|
||||
|
||||
bool BaseTween::isValid(int step)
|
||||
{
|
||||
return (step >= 0 && step <= repeatCnt*2) || repeatCnt < 0;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Update engine
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Updates the tween or timeline state. <b>You may want to use a
|
||||
* TweenManager to update objects for you.</b>
|
||||
*
|
||||
* Slow motion, fast motion and backward play can be easily achieved by
|
||||
* tweaking this delta time. Multiply it by -1 to play the animation
|
||||
* backward, or by 0.5 to play it twice slower than its normal speed.
|
||||
*
|
||||
* @param delta A delta time between now and the last call.
|
||||
*/
|
||||
void BaseTween::update(float delta)
|
||||
{
|
||||
if (!isStartedFlag || isPausedFlag || isKilledFlag) return;
|
||||
|
||||
deltaTime = delta;
|
||||
|
||||
if (!isInitializedFlag) initialize();
|
||||
|
||||
if (isInitializedFlag)
|
||||
{
|
||||
testRelaunch();
|
||||
updateStep();
|
||||
testCompletion();
|
||||
}
|
||||
|
||||
currentTime += deltaTime;
|
||||
deltaTime = 0;
|
||||
}
|
||||
|
||||
void BaseTween::initialize() {
|
||||
if (currentTime+deltaTime >= delayStart)
|
||||
{
|
||||
initializeOverride();
|
||||
isInitializedFlag = true;
|
||||
isIterationStep = true;
|
||||
step = 0;
|
||||
deltaTime -= delayStart-currentTime;
|
||||
currentTime = 0;
|
||||
callCallback(TweenCallback::BEGIN);
|
||||
callCallback(TweenCallback::START);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseTween::testRelaunch()
|
||||
{
|
||||
if (!isIterationStep && repeatCnt >= 0 && step < 0 && currentTime+deltaTime >= 0)
|
||||
{
|
||||
// assert(step == -1);
|
||||
isIterationStep = true;
|
||||
step = 0;
|
||||
float delta = 0-currentTime;
|
||||
deltaTime -= delta;
|
||||
currentTime = 0;
|
||||
callCallback(TweenCallback::BEGIN);
|
||||
callCallback(TweenCallback::START);
|
||||
updateOverride(step, step-1, isIterationStep, delta);
|
||||
|
||||
}
|
||||
else if (!isIterationStep && repeatCnt >= 0 && step > repeatCnt*2 && currentTime+deltaTime < 0)
|
||||
{
|
||||
// assert(step == repeatCnt*2 + 1);
|
||||
isIterationStep = true;
|
||||
step = repeatCnt*2;
|
||||
float delta = 0-currentTime;
|
||||
deltaTime -= delta;
|
||||
currentTime = duration;
|
||||
callCallback(TweenCallback::BACK_BEGIN);
|
||||
callCallback(TweenCallback::BACK_START);
|
||||
updateOverride(step, step+1, isIterationStep, delta);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseTween::updateStep()
|
||||
{
|
||||
while (isValid(step))
|
||||
{
|
||||
if (!isIterationStep && currentTime+deltaTime <= 0)
|
||||
{
|
||||
isIterationStep = true;
|
||||
step -= 1;
|
||||
|
||||
float delta = 0-currentTime;
|
||||
deltaTime -= delta;
|
||||
currentTime = duration;
|
||||
|
||||
if (isReverse(step)) forceStartValues();
|
||||
else forceEndValues();
|
||||
callCallback(TweenCallback::BACK_START);
|
||||
updateOverride(step, step+1, isIterationStep, delta);
|
||||
|
||||
}
|
||||
else if (!isIterationStep && currentTime+deltaTime >= repeatDelay)
|
||||
{
|
||||
isIterationStep = true;
|
||||
step += 1;
|
||||
|
||||
float delta = repeatDelay-currentTime;
|
||||
deltaTime -= delta;
|
||||
currentTime = 0;
|
||||
|
||||
if (isReverse(step)) forceEndValues(); else forceStartValues();
|
||||
callCallback(TweenCallback::START);
|
||||
updateOverride(step, step-1, isIterationStep, delta);
|
||||
|
||||
}
|
||||
else if (isIterationStep && currentTime+deltaTime < 0)
|
||||
{
|
||||
isIterationStep = false;
|
||||
step -= 1;
|
||||
|
||||
float delta = 0-currentTime;
|
||||
deltaTime -= delta;
|
||||
currentTime = 0;
|
||||
|
||||
updateOverride(step, step+1, isIterationStep, delta);
|
||||
callCallback(TweenCallback::BACK_END);
|
||||
|
||||
if (step < 0 && repeatCnt >= 0) callCallback(TweenCallback::BACK_COMPLETE);
|
||||
else currentTime = repeatDelay;
|
||||
|
||||
}
|
||||
else if (isIterationStep && currentTime+deltaTime > duration)
|
||||
{
|
||||
isIterationStep = false;
|
||||
step += 1;
|
||||
|
||||
float delta = duration-currentTime;
|
||||
deltaTime -= delta;
|
||||
currentTime = duration;
|
||||
|
||||
updateOverride(step, step-1, isIterationStep, delta);
|
||||
callCallback(TweenCallback::END);
|
||||
|
||||
if (step > repeatCnt*2 && repeatCnt >= 0) callCallback(TweenCallback::COMPLETE);
|
||||
currentTime = 0;
|
||||
|
||||
}
|
||||
else if (isIterationStep)
|
||||
{
|
||||
float delta = deltaTime;
|
||||
deltaTime -= delta;
|
||||
currentTime += delta;
|
||||
updateOverride(step, step, isIterationStep, delta);
|
||||
break;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
float delta = deltaTime;
|
||||
deltaTime -= delta;
|
||||
currentTime += delta;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BaseTween::testCompletion()
|
||||
{
|
||||
isFinishedFlag = repeatCnt >= 0 && (step > repeatCnt*2 || step < 0);
|
||||
}
|
||||
|
||||
|
||||
}
|
796
external/tween-engine/src/Tween.cpp
vendored
796
external/tween-engine/src/Tween.cpp
vendored
@ -1,796 +0,0 @@
|
||||
//
|
||||
// Tween.cpp
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
/**
|
||||
* Core class of the Tween Engine. A Tween is basically an interpolation
|
||||
* between two values of an object attribute. However, the main interest of a
|
||||
* Tween is that you can apply an easing formula on this interpolation, in
|
||||
* order to smooth the transitions or to achieve cool effects like springs or
|
||||
* bounces.
|
||||
* <p/>
|
||||
*
|
||||
* The Universal Tween Engine is called "universal" because it is able to apply
|
||||
* interpolations on every attribute from every possible object. Therefore,
|
||||
* every object in your application can be animated with cool effects: it does
|
||||
* not matter if your application is a game, a desktop interface or even a
|
||||
* console program! If it makes sense to animate something, then it can be
|
||||
* animated through this engine.
|
||||
* <p/>
|
||||
*
|
||||
* This class contains many static factory methods to create and instantiate
|
||||
* new interpolations easily. The common way to create a Tween is by using one
|
||||
* of these factories:
|
||||
* <p/>
|
||||
*
|
||||
* - Tween.to(...)<br/>
|
||||
* - Tween.from(...)<br/>
|
||||
* - Tween.set(...)<br/>
|
||||
* - Tween.call(...)
|
||||
* <p/>
|
||||
*
|
||||
* <h2>Example - firing a Tween</h2>
|
||||
*
|
||||
* The following example will move the target horizontal position from its
|
||||
* current value to x=200 and y=300, during 500ms, but only after a delay of
|
||||
* 1000ms. The animation will also be repeated 2 times (the starting position
|
||||
* is registered at the end of the delay, so the animation will automatically
|
||||
* restart from this registered position).
|
||||
* <p/>
|
||||
*
|
||||
* <pre> {@code
|
||||
* Tween.to(myObject, POSITION_XY, 0.5f)
|
||||
* .target(200, 300)
|
||||
* .ease(Quad.INOUT)
|
||||
* .delay(1.0f)
|
||||
* .repeat(2, 0.2f)
|
||||
* .start(myManager);
|
||||
* }</pre>
|
||||
*
|
||||
* Tween life-cycles can be automatically managed for you, thanks to the
|
||||
* {@link TweenManager} class. If you choose to manage your tween when you start
|
||||
* it, then you don't need to care about it anymore. <b>Tweens are
|
||||
* <i>fire-and-forget</i>: don't think about them anymore once you started
|
||||
* them (if they are managed of course).</b>
|
||||
* <p/>
|
||||
*
|
||||
* You need to periodicaly update the tween engine, in order to compute the new
|
||||
* values. If your tweens are managed, only update the manager; else you need
|
||||
* to call {@link #update()} on your tweens periodically.
|
||||
* <p/>
|
||||
*
|
||||
* <h2>Example - setting up the engine</h2>
|
||||
*
|
||||
* The engine cannot directly change your objects attributes, since it doesn't
|
||||
* know them. Therefore, you need to tell him how to get and set the different
|
||||
* attributes of your objects: <b>you need to implement the {@link
|
||||
* TweenAccessor} interface for each object class you will animate</b>. Once
|
||||
* done, don't forget to register these implementations, using the static method
|
||||
* {@link registerAccessor()}, when you start your application.
|
||||
*
|
||||
* @see TweenAccessor
|
||||
* @see TweenManager
|
||||
* @see TweenEquation
|
||||
* @see Timeline
|
||||
* @author Aurelien Ribon | http://www.aurelienribon.com/
|
||||
*/
|
||||
|
||||
//#define NDEBUG
|
||||
|
||||
#include <TweenEngine/Tween.h>
|
||||
#include <TweenEngine/TweenPool.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
int Tween::combinedAttrsLimit = 3;
|
||||
int Tween::waypointsLimit = 0;
|
||||
|
||||
/**
|
||||
* Changes the limit for combined attributes. Defaults to 3 to reduce
|
||||
* memory footprint.
|
||||
*/
|
||||
void Tween::setCombinedAttributesLimit(int limit) { Tween::combinedAttrsLimit = limit; }
|
||||
|
||||
/**
|
||||
* Changes the limit of allowed waypoints for each tween. Defaults to 0 to
|
||||
* reduce memory footprint.
|
||||
*/
|
||||
void Tween::setWaypointsLimit(int limit) { Tween::waypointsLimit = limit; }
|
||||
|
||||
/**
|
||||
* Gets the version number of the library.
|
||||
*/
|
||||
const char *Tween::getVersion() { return "6.3.3"; }
|
||||
|
||||
/**
|
||||
* Used for debug purpose. Gets the current number of objects that are
|
||||
* waiting in the Tween pool.
|
||||
*/
|
||||
int Tween::getPoolSize() { return pool.size(); }
|
||||
|
||||
/**
|
||||
* Increases the minimum capacity of the pool. Capacity defaults to 20.
|
||||
*/
|
||||
void Tween::ensurePoolCapacity(int minCapacity) { pool.ensureCapacity(minCapacity); }
|
||||
|
||||
TweenPool &Tween::pool = *(new TweenPool());
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Static -- factories
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Factory creating a new standard interpolation. This is the most common
|
||||
* type of interpolation. The starting values are retrieved automatically
|
||||
* after the delay (if any).
|
||||
* <br/><br/>
|
||||
*
|
||||
* <b>You need to set the target values of the interpolation by using one
|
||||
* of the target() methods</b>. The interpolation will run from the
|
||||
* starting values to these target values.
|
||||
* <br/><br/>
|
||||
*
|
||||
* The common use of Tweens is "fire-and-forget": you do not need to care
|
||||
* for tweens once you added them to a TweenManager, they will be updated
|
||||
* automatically, and cleaned once finished. Common call:
|
||||
* <br/><br/>
|
||||
*
|
||||
* <pre> {@code
|
||||
* Tween.to(myObject, POSITION, 1.0f)
|
||||
* .target(50, 70)
|
||||
* .ease(Quad.INOUT)
|
||||
* .start(myManager);
|
||||
* }</pre>
|
||||
*
|
||||
* Several options such as delay, repetitions and callbacks can be added to
|
||||
* the tween.
|
||||
*
|
||||
* @param target The target object of the interpolation.
|
||||
* @param tweenType The desired type of interpolation.
|
||||
* @param duration The duration of the interpolation, in milliseconds.
|
||||
* @return The generated Tween.
|
||||
*/
|
||||
Tween &Tween::to(Tweenable& target, int tweenType, float duration)
|
||||
{
|
||||
Tween &tween = *(pool.get());
|
||||
tween.setup(&target, tweenType, duration);
|
||||
tween.ease(TweenEquations::easeInOutQuad);
|
||||
tween.path(TweenPaths::catmullRom);
|
||||
return tween;
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory creating a new reversed interpolation. The ending values are
|
||||
* retrieved automatically after the delay (if any).
|
||||
* <br/><br/>
|
||||
*
|
||||
* <b>You need to set the starting values of the interpolation by using one
|
||||
* of the target() methods</b>. The interpolation will run from the
|
||||
* starting values to these target values.
|
||||
* <br/><br/>
|
||||
*
|
||||
* The common use of Tweens is "fire-and-forget": you do not need to care
|
||||
* for tweens once you added them to a TweenManager, they will be updated
|
||||
* automatically, and cleaned once finished. Common call:
|
||||
* <br/><br/>
|
||||
*
|
||||
* <pre> {@code
|
||||
* Tween.from(myObject, POSITION, 1.0f)
|
||||
* .target(0, 0)
|
||||
* .ease(Quad.INOUT)
|
||||
* .start(myManager);
|
||||
* }</pre>
|
||||
*
|
||||
* Several options such as delay, repetitions and callbacks can be added to
|
||||
* the tween.
|
||||
*
|
||||
* @param target The target object of the interpolation.
|
||||
* @param tweenType The desired type of interpolation.
|
||||
* @param duration The duration of the interpolation, in milliseconds.
|
||||
* @return The generated Tween.
|
||||
*/
|
||||
Tween &Tween::from(Tweenable& target, int tweenType, float duration)
|
||||
{
|
||||
Tween &tween = *(pool.get());
|
||||
tween.setup(&target, tweenType, duration);
|
||||
tween.ease(TweenEquations::easeInOutQuad);
|
||||
tween.path(TweenPaths::catmullRom);
|
||||
tween.isFrom = true;
|
||||
return tween;
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory creating a new instantaneous interpolation (thus this is not
|
||||
* really an interpolation).
|
||||
* <br/><br/>
|
||||
*
|
||||
* <b>You need to set the target values of the interpolation by using one
|
||||
* of the target() methods</b>. The interpolation will set the target
|
||||
* attribute to these values after the delay (if any).
|
||||
* <br/><br/>
|
||||
*
|
||||
* The common use of Tweens is "fire-and-forget": you do not need to care
|
||||
* for tweens once you added them to a TweenManager, they will be updated
|
||||
* automatically, and cleaned once finished. Common call:
|
||||
* <br/><br/>
|
||||
*
|
||||
* <pre> {@code
|
||||
* Tween.set(myObject, POSITION)
|
||||
* .target(50, 70)
|
||||
* .delay(1.0f)
|
||||
* .start(myManager);
|
||||
* }</pre>
|
||||
*
|
||||
* Several options such as delay, repetitions and callbacks can be added to
|
||||
* the tween.
|
||||
*
|
||||
* @param target The target object of the interpolation.
|
||||
* @param tweenType The desired type of interpolation.
|
||||
* @return The generated Tween.
|
||||
*/
|
||||
Tween &Tween::set(Tweenable& target, int tweenType)
|
||||
{
|
||||
Tween &tween = *(pool.get());
|
||||
tween.setup(&target, tweenType, 0);
|
||||
tween.ease(TweenEquations::easeInOutQuad);
|
||||
return tween;
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory creating a new timer. The given callback will be triggered on
|
||||
* each iteration start, after the delay.
|
||||
* <br/><br/>
|
||||
*
|
||||
* The common use of Tweens is "fire-and-forget": you do not need to care
|
||||
* for tweens once you added them to a TweenManager, they will be updated
|
||||
* automatically, and cleaned once finished. Common call:
|
||||
* <br/><br/>
|
||||
*
|
||||
* <pre> {@code
|
||||
* Tween.call(myCallback)
|
||||
* .delay(1.0f)
|
||||
* .repeat(10, 1000)
|
||||
* .start(myManager);
|
||||
* }</pre>
|
||||
*
|
||||
* @param callback The callback that will be triggered on each iteration
|
||||
* start.
|
||||
* @return The generated Tween.
|
||||
* @see TweenCallback
|
||||
*/
|
||||
Tween &Tween::call(TweenCallback &callback)
|
||||
{
|
||||
Tween &tween = *(pool.get());
|
||||
tween.setup(nullptr, -1, 0);
|
||||
tween.setCallback(&callback);
|
||||
tween.setCallbackTriggers(TweenCallback::START);
|
||||
return tween;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to create an empty tween. Such object is only useful
|
||||
* when placed inside animation sequences (see {@link Timeline}), in which
|
||||
* it may act as a beacon, so you can set a callback on it in order to
|
||||
* trigger some action at the right moment.
|
||||
*
|
||||
* @return The generated Tween.
|
||||
* @see Timeline
|
||||
*/
|
||||
Tween &Tween::mark()
|
||||
{
|
||||
Tween &tween = *(pool.get());
|
||||
tween.setup(nullptr, -1, 0);
|
||||
return tween;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Setup
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
Tween::Tween()
|
||||
{
|
||||
startValues = new float[combinedAttrsLimit];
|
||||
targetValues = new float[combinedAttrsLimit];
|
||||
waypoints = new float[waypointsLimit*combinedAttrsLimit];
|
||||
accessorBuffer = new float[combinedAttrsLimit];
|
||||
accessorBufferSize = combinedAttrsLimit;
|
||||
pathBuffer = new float[(2+waypointsLimit)*combinedAttrsLimit];
|
||||
pathBufferSize = (2+waypointsLimit)*combinedAttrsLimit;
|
||||
targetObj = nullptr;
|
||||
}
|
||||
|
||||
Tween::~Tween()
|
||||
{
|
||||
delete startValues;
|
||||
delete targetValues;
|
||||
delete waypoints;
|
||||
delete accessorBuffer;
|
||||
delete pathBuffer;
|
||||
// if (accessor != nullptr) Block_release(accessor);
|
||||
}
|
||||
|
||||
void Tween::reset()
|
||||
{
|
||||
BaseTween::reset();
|
||||
|
||||
equation = nullptr;
|
||||
pathAlgorithm = nullptr;
|
||||
isFrom = isRelative = false;
|
||||
combinedAttrsCnt = waypointsCnt = 0;
|
||||
|
||||
if (accessorBufferSize != combinedAttrsLimit) {
|
||||
accessorBuffer = new float[combinedAttrsLimit];
|
||||
}
|
||||
|
||||
if (pathBufferSize != (2+waypointsLimit)*combinedAttrsLimit) {
|
||||
pathBuffer = new float[(2+waypointsLimit)*combinedAttrsLimit];
|
||||
}
|
||||
|
||||
// if (accessor != nullptr)
|
||||
// {
|
||||
// Block_release(accessor);
|
||||
targetObj = nullptr;
|
||||
// }
|
||||
type = -1;
|
||||
}
|
||||
|
||||
void Tween::setup(Tweenable *target, int tweenType, float duration)
|
||||
{
|
||||
// assert(duration >= 0);
|
||||
this->targetObj = target;
|
||||
this->type = tweenType;
|
||||
this->duration = duration;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Public API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Sets the easing equation of the tween. Existing equations are located in
|
||||
* <i>aurelienribon.tweenengine.equations</i> package, but you can of course
|
||||
* implement your owns, see {@link TweenEquation}. You can also use the
|
||||
* {@link TweenEquations} static instances to quickly access all the
|
||||
* equations. Default equation is Quad.INOUT.
|
||||
* <p/>
|
||||
*
|
||||
* <b>Proposed equations are:</b><br/>
|
||||
* - Linear.INOUT,<br/>
|
||||
* - Quad.IN | OUT | INOUT,<br/>
|
||||
* - Cubic.IN | OUT | INOUT,<br/>
|
||||
* - Quart.IN | OUT | INOUT,<br/>
|
||||
* - Quint.IN | OUT | INOUT,<br/>
|
||||
* - Circ.IN | OUT | INOUT,<br/>
|
||||
* - Sine.IN | OUT | INOUT,<br/>
|
||||
* - Expo.IN | OUT | INOUT,<br/>
|
||||
* - Back.IN | OUT | INOUT,<br/>
|
||||
* - Bounce.IN | OUT | INOUT,<br/>
|
||||
* - Elastic.IN | OUT | INOUT
|
||||
*
|
||||
* @return The current tween, for chaining instructions.
|
||||
* @see TweenEquation
|
||||
* @see TweenEquations
|
||||
*/
|
||||
Tween &Tween::ease(TweenEquation &easeEquation)
|
||||
{
|
||||
this->equation = &easeEquation;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the target value of the interpolation. The interpolation will run
|
||||
* from the <b>value at start time (after the delay, if any)</b> to this
|
||||
* target value.
|
||||
* <p/>
|
||||
*
|
||||
* To sum-up:<br/>
|
||||
* - start value: value at start time, after delay<br/>
|
||||
* - end value: param
|
||||
*
|
||||
* @param targetValue The target value of the interpolation.
|
||||
* @return The current tween, for chaining instructions.
|
||||
*/
|
||||
Tween &Tween::target(float targetValue)
|
||||
{
|
||||
targetValues[0] = targetValue;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the target values of the interpolation. The interpolation will run
|
||||
* from the <b>values at start time (after the delay, if any)</b> to these
|
||||
* target values.
|
||||
* <p/>
|
||||
*
|
||||
* To sum-up:<br/>
|
||||
* - start values: values at start time, after delay<br/>
|
||||
* - end values: params
|
||||
*
|
||||
* @param targetValue1 The 1st target value of the interpolation.
|
||||
* @param targetValue2 The 2nd target value of the interpolation.
|
||||
* @return The current tween, for chaining instructions.
|
||||
*/
|
||||
Tween &Tween::target(float targetValue1, float targetValue2)
|
||||
{
|
||||
targetValues[0] = targetValue1;
|
||||
targetValues[1] = targetValue2;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the target values of the interpolation. The interpolation will run
|
||||
* from the <b>values at start time (after the delay, if any)</b> to these
|
||||
* target values.
|
||||
* <p/>
|
||||
*
|
||||
* To sum-up:<br/>
|
||||
* - start values: values at start time, after delay<br/>
|
||||
* - end values: params
|
||||
*
|
||||
* @param targetValue1 The 1st target value of the interpolation.
|
||||
* @param targetValue2 The 2nd target value of the interpolation.
|
||||
* @param targetValue3 The 3rd target value of the interpolation.
|
||||
* @return The current tween, for chaining instructions.
|
||||
*/
|
||||
Tween &Tween::target(float targetValue1, float targetValue2, float targetValue3)
|
||||
{
|
||||
targetValues[0] = targetValue1;
|
||||
targetValues[1] = targetValue2;
|
||||
targetValues[2] = targetValue3;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Tween &Tween::target(float *targetValues, int len)
|
||||
{
|
||||
if (len <= combinedAttrsLimit)
|
||||
{
|
||||
for (int i=0; i<len; i++)
|
||||
this->targetValues[i] = targetValues[i];
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the target value of the interpolation, relatively to the <b>value
|
||||
* at start time (after the delay, if any)</b>.
|
||||
* <p/>
|
||||
*
|
||||
* To sum-up:<br/>
|
||||
* - start value: value at start time, after delay<br/>
|
||||
* - end value: param + value at start time, after delay
|
||||
*
|
||||
* @param targetValue The relative target value of the interpolation.
|
||||
* @return The current tween, for chaining instructions.
|
||||
*/
|
||||
Tween &Tween::targetRelative(float targetValue)
|
||||
{
|
||||
isRelative = true;
|
||||
targetValues[0] = isInitialized() ? targetValue + startValues[0] : targetValue;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the target values of the interpolation, relatively to the <b>values
|
||||
* at start time (after the delay, if any)</b>.
|
||||
* <p/>
|
||||
*
|
||||
* To sum-up:<br/>
|
||||
* - start values: values at start time, after delay<br/>
|
||||
* - end values: params + values at start time, after delay
|
||||
*
|
||||
* @param targetValue1 The 1st relative target value of the interpolation.
|
||||
* @param targetValue2 The 2nd relative target value of the interpolation.
|
||||
* @return The current tween, for chaining instructions.
|
||||
*/
|
||||
Tween &Tween::targetRelative(float targetValue1, float targetValue2)
|
||||
{
|
||||
isRelative = true;
|
||||
targetValues[0] = isInitialized() ? targetValue1 + startValues[0] : targetValue1;
|
||||
targetValues[1] = isInitialized() ? targetValue2 + startValues[1] : targetValue2;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the target values of the interpolation, relatively to the <b>values
|
||||
* at start time (after the delay, if any)</b>.
|
||||
* <p/>
|
||||
*
|
||||
* To sum-up:<br/>
|
||||
* - start values: values at start time, after delay<br/>
|
||||
* - end values: params + values at start time, after delay
|
||||
*
|
||||
* @param targetValue1 The 1st relative target value of the interpolation.
|
||||
* @param targetValue2 The 2nd relative target value of the interpolation.
|
||||
* @param targetValue3 The 3rd relative target value of the interpolation.
|
||||
* @return The current tween, for chaining instructions.
|
||||
*/
|
||||
Tween &Tween::targetRelative(float targetValue1, float targetValue2, float targetValue3)
|
||||
{
|
||||
isRelative = true;
|
||||
targetValues[0] = isInitialized() ? targetValue1 + startValues[0] : targetValue1;
|
||||
targetValues[1] = isInitialized() ? targetValue2 + startValues[1] : targetValue2;
|
||||
targetValues[2] = isInitialized() ? targetValue3 + startValues[2] : targetValue3;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the target values of the interpolation, relatively to the <b>values
|
||||
* at start time (after the delay, if any)</b>.
|
||||
* <p/>
|
||||
*
|
||||
* To sum-up:<br/>
|
||||
* - start values: values at start time, after delay<br/>
|
||||
* - end values: params + values at start time, after delay
|
||||
*
|
||||
* @param targetValues The relative target values of the interpolation.
|
||||
* @return The current tween, for chaining instructions.
|
||||
*/
|
||||
Tween &Tween::targetRelative(float *targetValues, int len)
|
||||
{
|
||||
if (len <= combinedAttrsLimit)
|
||||
{
|
||||
for (int i=0; i<len; i++)
|
||||
this->targetValues[i] = isInitialized() ? targetValues[i] + startValues[i] : targetValues[i];
|
||||
}
|
||||
|
||||
isRelative = true;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a waypoint to the path. The default path runs from the start values
|
||||
* to the end values linearly. If you add waypoints, the default path will
|
||||
* use a smooth catmull-rom spline to navigate between the waypoints, but
|
||||
* you can change this behavior by using the {@link #path(TweenPath)}
|
||||
* method.
|
||||
* <p/>
|
||||
* Note that if you want waypoints relative to the start values, use one of
|
||||
* the .targetRelative() methods to define your target.
|
||||
*
|
||||
* @param targetValue The target of this waypoint.
|
||||
* @return The current tween, for chaining instructions.
|
||||
*/
|
||||
Tween &Tween::waypoint(float targetValue)
|
||||
{
|
||||
if (waypointsCnt < waypointsLimit)
|
||||
{
|
||||
waypoints[waypointsCnt] = targetValue;
|
||||
waypointsCnt += 1;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a waypoint to the path. The default path runs from the start values
|
||||
* to the end values linearly. If you add waypoints, the default path will
|
||||
* use a smooth catmull-rom spline to navigate between the waypoints, but
|
||||
* you can change this behavior by using the {@link #path(TweenPath)}
|
||||
* method.
|
||||
* <p/>
|
||||
* Note that if you want waypoints relative to the start values, use one of
|
||||
* the .targetRelative() methods to define your target.
|
||||
*
|
||||
* @param targetValue1 The 1st target of this waypoint.
|
||||
* @param targetValue2 The 2nd target of this waypoint.
|
||||
* @return The current tween, for chaining instructions.
|
||||
*/
|
||||
Tween &Tween::waypoint(float targetValue1, float targetValue2)
|
||||
{
|
||||
if (waypointsCnt < waypointsLimit)
|
||||
{
|
||||
waypoints[waypointsCnt*2] = targetValue1;
|
||||
waypoints[waypointsCnt*2+1] = targetValue2;
|
||||
waypointsCnt += 1;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a waypoint to the path. The default path runs from the start values
|
||||
* to the end values linearly. If you add waypoints, the default path will
|
||||
* use a smooth catmull-rom spline to navigate between the waypoints, but
|
||||
* you can change this behavior by using the {@link #path(TweenPath)}
|
||||
* method.
|
||||
* <p/>
|
||||
* Note that if you want waypoints relative to the start values, use one of
|
||||
* the .targetRelative() methods to define your target.
|
||||
*
|
||||
* @param targetValue1 The 1st target of this waypoint.
|
||||
* @param targetValue2 The 2nd target of this waypoint.
|
||||
* @param targetValue3 The 3rd target of this waypoint.
|
||||
* @return The current tween, for chaining instructions.
|
||||
*/
|
||||
Tween &Tween::waypoint(float targetValue1, float targetValue2, float targetValue3)
|
||||
{
|
||||
if (waypointsCnt < waypointsLimit)
|
||||
{
|
||||
waypoints[waypointsCnt*3] = targetValue1;
|
||||
waypoints[waypointsCnt*3+1] = targetValue2;
|
||||
waypoints[waypointsCnt*3+2] = targetValue3;
|
||||
waypointsCnt += 1;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a waypoint to the path. The default path runs from the start values
|
||||
* to the end values linearly. If you add waypoints, the default path will
|
||||
* use a smooth catmull-rom spline to navigate between the waypoints, but
|
||||
* you can change this behavior by using the {@link #path(TweenPath)}
|
||||
* method.
|
||||
* <p/>
|
||||
* Note that if you want waypoints relative to the start values, use one of
|
||||
* the .targetRelative() methods to define your target.
|
||||
*
|
||||
* @param targetValues The targets of this waypoint.
|
||||
* @return The current tween, for chaining instructions.
|
||||
*/
|
||||
Tween &Tween::waypoint(float *targetValues, int len)
|
||||
{
|
||||
if (waypointsCnt < waypointsLimit)
|
||||
{
|
||||
for (int i=0; i<len; i++)
|
||||
this->waypoints[waypointsCnt*len+i] = targetValues[i];
|
||||
waypointsCnt += 1;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the algorithm that will be used to navigate through the waypoints,
|
||||
* from the start values to the end values. Default is a catmull-rom spline,
|
||||
* but you can find other paths in the {@link TweenPaths} class.
|
||||
*
|
||||
* @param path A TweenPath implementation.
|
||||
* @return The current tween, for chaining instructions.
|
||||
* @see TweenPath
|
||||
* @see TweenPaths
|
||||
*/
|
||||
Tween &Tween::path(TweenPath &path)
|
||||
{
|
||||
this->pathAlgorithm = &path;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Getters
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Gets the easing equation.
|
||||
*/
|
||||
TweenEquation *Tween::getEasing() { return equation; }
|
||||
|
||||
/**
|
||||
* Gets the target values. The returned buffer is as long as the maximum
|
||||
* allowed combined values. Therefore, you're surely not interested in all
|
||||
* its content. Use {@link #getCombinedTweenCount()} to get the number of
|
||||
* interesting slots.
|
||||
*/
|
||||
float *Tween::getTargetValues() { return targetValues; }
|
||||
|
||||
/**
|
||||
* Gets the number of combined animations.
|
||||
*/
|
||||
int Tween::getCombinedAttributesCount() { return combinedAttrsCnt; }
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Base Class
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
Tween &Tween::build()
|
||||
{
|
||||
if (targetObj != nullptr) {
|
||||
combinedAttrsCnt = targetObj->getValues(type, accessorBuffer);
|
||||
}
|
||||
// assert(combinedAttrsCnt <= combinedAttrsLimit);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Tween::free() { pool.free(this); }
|
||||
|
||||
void Tween::initializeOverride()
|
||||
{
|
||||
targetObj->getValues(type, startValues);
|
||||
|
||||
for (int i=0; i<combinedAttrsCnt; i++) {
|
||||
targetValues[i] += isRelative ? startValues[i] : 0;
|
||||
|
||||
for (int ii=0; ii<waypointsCnt; ii++) {
|
||||
waypoints[ii*combinedAttrsCnt+i] += isRelative ? startValues[i] : 0;
|
||||
}
|
||||
|
||||
if (isFrom) {
|
||||
float tmp = startValues[i];
|
||||
startValues[i] = targetValues[i];
|
||||
targetValues[i] = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Tween::updateOverride(int step, int lastStep, bool isIterationStep, float delta)
|
||||
{
|
||||
if (equation == nullptr) return;
|
||||
|
||||
// Case iteration end has been reached
|
||||
|
||||
if (!isIterationStep && step > lastStep)
|
||||
{
|
||||
targetObj->setValues(type, isReverse(lastStep) ? startValues : targetValues);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isIterationStep && step < lastStep)
|
||||
{
|
||||
targetObj->setValues(type, isReverse(lastStep) ? targetValues : startValues);
|
||||
return;
|
||||
}
|
||||
|
||||
// Validation
|
||||
|
||||
// assert(isIterationStep);
|
||||
// assert(getCurrentTime() >= 0);
|
||||
// assert(getCurrentTime() <= duration);
|
||||
|
||||
// Case duration equals zero
|
||||
|
||||
if (duration < 0.00000000001f && delta > -0.00000000001f)
|
||||
{
|
||||
targetObj->setValues(type, isReverse(step) ? targetValues : startValues);
|
||||
return;
|
||||
}
|
||||
|
||||
if (duration < 0.00000000001f && delta < 0.00000000001f) {
|
||||
targetObj->setValues(type, isReverse(step) ? startValues : targetValues);
|
||||
return;
|
||||
}
|
||||
|
||||
// Normal behavior
|
||||
|
||||
float time = isReverse(step) ? duration - getCurrentTime() : getCurrentTime();
|
||||
float t = equation->compute(time/duration);
|
||||
|
||||
if (waypointsCnt == 0 || pathAlgorithm == nullptr)
|
||||
{
|
||||
for (int i=0; i<combinedAttrsCnt; i++)
|
||||
{
|
||||
accessorBuffer[i] = startValues[i] + t * (targetValues[i] - startValues[i]);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i=0; i<combinedAttrsCnt; i++)
|
||||
{
|
||||
pathBuffer[0] = startValues[i];
|
||||
pathBuffer[1+waypointsCnt] = targetValues[i];
|
||||
for (int ii=0; ii<waypointsCnt; ii++)
|
||||
{
|
||||
pathBuffer[ii+1] = waypoints[ii*combinedAttrsCnt+i];
|
||||
}
|
||||
|
||||
accessorBuffer[i] = pathAlgorithm->compute(t, pathBuffer, waypointsCnt+2);
|
||||
}
|
||||
}
|
||||
|
||||
targetObj->setValues(type, accessorBuffer);
|
||||
}
|
||||
|
||||
void Tween::forceStartValues(){
|
||||
targetObj->setValues(type, startValues);
|
||||
}
|
||||
|
||||
void Tween::forceEndValues(){
|
||||
targetObj->setValues(type, targetValues);
|
||||
}
|
||||
|
||||
int Tween::getTweenCount() { return 1; }
|
||||
|
||||
int Tween::getTimelineCount() { return 0; }
|
||||
|
||||
}
|
53
external/tween-engine/src/TweenEquations.cpp
vendored
53
external/tween-engine/src/TweenEquations.cpp
vendored
@ -1,53 +0,0 @@
|
||||
//
|
||||
// Equations.cpp
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#include <TweenEngine/TweenEquations.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
TweenEquation &TweenEquations::easeInQuad = *(new QuadIn());
|
||||
TweenEquation &TweenEquations::easeOutQuad = *(new QuadOut());
|
||||
TweenEquation &TweenEquations::easeInOutQuad = *(new QuadInOut());
|
||||
|
||||
TweenEquation &TweenEquations::easeInOutLinear = *(new LinearInOut());
|
||||
|
||||
TweenEquation &TweenEquations::easeInBack = *(new BackIn());
|
||||
TweenEquation &TweenEquations::easeOutBack = *(new BackOut());
|
||||
TweenEquation &TweenEquations::easeInOutBack = *(new BackInOut());
|
||||
|
||||
TweenEquation &TweenEquations::easeInBounce = *(new BounceIn());
|
||||
TweenEquation &TweenEquations::easeOutBounce = *(new BounceOut());
|
||||
TweenEquation &TweenEquations::easeInOutBounce = *(new BounceInOut());
|
||||
|
||||
TweenEquation &TweenEquations::easeInCirc = *(new CircIn());
|
||||
TweenEquation &TweenEquations::easeOutCirc = *(new CircOut());
|
||||
TweenEquation &TweenEquations::easeInOutCirc = *(new CircInOut());
|
||||
|
||||
TweenEquation &TweenEquations::easeInCubic = *(new CubicIn());
|
||||
TweenEquation &TweenEquations::easeOutCubic = *(new CubicOut());
|
||||
TweenEquation &TweenEquations::easeInOutCubic = *(new CubicInOut());
|
||||
|
||||
TweenEquation &TweenEquations::easeInElastic = *(new ElasticIn());
|
||||
TweenEquation &TweenEquations::easeOutElastic = *(new ElasticOut());
|
||||
TweenEquation &TweenEquations::easeInOutElastic = *(new ElasticInOut());
|
||||
|
||||
TweenEquation &TweenEquations::easeInExpo = *(new ExpoIn());
|
||||
TweenEquation &TweenEquations::easeOutExpo = *(new ExpoOut());
|
||||
TweenEquation &TweenEquations::easeInOutExpo = *(new ExpoInOut());
|
||||
|
||||
TweenEquation &TweenEquations::easeInQuart = *(new QuartIn());
|
||||
TweenEquation &TweenEquations::easeOutQuart = *(new QuartOut());
|
||||
TweenEquation &TweenEquations::easeInOutQuart = *(new QuartInOut());
|
||||
|
||||
TweenEquation &TweenEquations::easeInQuint = *(new QuintIn());
|
||||
TweenEquation &TweenEquations::easeOutQuint = *(new QuintOut());
|
||||
TweenEquation &TweenEquations::easeInOutQuint = *(new QuintInOut());
|
||||
|
||||
TweenEquation &TweenEquations::easeInSine = *(new SineIn());
|
||||
TweenEquation &TweenEquations::easeOutSine = *(new SineOut());
|
||||
TweenEquation &TweenEquations::easeInOutSine = *(new SineInOut());
|
||||
}
|
186
external/tween-engine/src/TweenManager.cpp
vendored
186
external/tween-engine/src/TweenManager.cpp
vendored
@ -1,186 +0,0 @@
|
||||
//
|
||||
// TweenManager.cpp
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#include <TweenEngine/TweenManager.h>
|
||||
#include <TweenEngine/BaseTween.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
// -------------------------------------------------------------------------
|
||||
// Static API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Disables or enables the "auto remove" mode of any tween manager for a
|
||||
* particular tween or timeline. This mode is activated by default. The
|
||||
* interest of desactivating it is to prevent some tweens or timelines from
|
||||
* being automatically removed from a manager once they are finished.
|
||||
* Therefore, if you update a manager backwards, the tweens or timelines
|
||||
* will be played again, even if they were finished.
|
||||
*/
|
||||
void TweenManager::setAutoRemove(BaseTween &object, bool value)
|
||||
{
|
||||
object.isAutoRemoveEnabled = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables or enables the "auto start" mode of any tween manager for a
|
||||
* particular tween or timeline. This mode is activated by default. If it
|
||||
* is not enabled, add a tween or timeline to any manager won't start it
|
||||
* automatically, and you'll need to call .start() manually on your object.
|
||||
*/
|
||||
void TweenManager::setAutoStart(BaseTween &object, bool value)
|
||||
{
|
||||
object.isAutoStartEnabled = value;
|
||||
}
|
||||
|
||||
int getTweensCount(std::vector<BaseTween *> objs)
|
||||
{
|
||||
int cnt = 0;
|
||||
for (int i=0, n=objs.size(); i<n; i++)
|
||||
{
|
||||
cnt += objs[i]->getTweenCount();
|
||||
}
|
||||
return cnt;
|
||||
}
|
||||
|
||||
int getTimelinesCount(std::vector<BaseTween *> objs)
|
||||
{
|
||||
int cnt = 0;
|
||||
for (int i=0, n=objs.size(); i<n; i++)
|
||||
{
|
||||
cnt += objs[i]->getTimelineCount();
|
||||
}
|
||||
return cnt;
|
||||
}
|
||||
|
||||
bool isTweenFinished(BaseTween *obj)
|
||||
{
|
||||
if (obj->isFinished() && obj->isAutoRemoveEnabled)
|
||||
{
|
||||
obj->free();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
TweenManager::TweenManager() : objects()
|
||||
{
|
||||
objects.reserve(20);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a tween or timeline to the manager and starts or restarts it.
|
||||
*
|
||||
* @return The manager, for instruction chaining.
|
||||
*/
|
||||
TweenManager &TweenManager::add(BaseTween &object)
|
||||
{
|
||||
bool isPresent = (std::find(objects.begin(), objects.end(), &object) != objects.end());
|
||||
if (!isPresent) objects.push_back(&object);
|
||||
if (object.isAutoStartEnabled) object.start();
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Kills every managed tweens and timelines.
|
||||
*/
|
||||
void TweenManager::killAll()
|
||||
{
|
||||
for (int i=0, n=objects.size(); i<n; i++)
|
||||
{
|
||||
BaseTween *obj = objects[i];
|
||||
obj->kill();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Increases the minimum capacity of the manager. Defaults to 20.
|
||||
*/
|
||||
void TweenManager::ensureCapacity(int minCapacity) { objects.reserve(minCapacity); }
|
||||
|
||||
/**
|
||||
* Pauses the manager. Further update calls won't have any effect.
|
||||
*/
|
||||
void TweenManager::pause() { isPaused = true; }
|
||||
|
||||
/**
|
||||
* Resumes the manager, if paused.
|
||||
*/
|
||||
void TweenManager::resume() { isPaused = false; }
|
||||
|
||||
/**
|
||||
* Updates every tweens with a delta time ang handles the tween life-cycles
|
||||
* automatically. If a tween is finished, it will be removed from the
|
||||
* manager. The delta time represents the elapsed time between now and the
|
||||
* last update call. Each tween or timeline manages its local time, and adds
|
||||
* this delta to its local time to update itself.
|
||||
* <p/>
|
||||
*
|
||||
* Slow motion, fast motion and backward play can be easily achieved by
|
||||
* tweaking this delta time. Multiply it by -1 to play the animation
|
||||
* backward, or by 0.5 to play it twice slower than its normal speed.
|
||||
*/
|
||||
|
||||
void TweenManager::update(float delta)
|
||||
{
|
||||
// Remove tweens that are finished
|
||||
objects.erase(std::remove_if(objects.begin(),objects.end(),isTweenFinished), objects.end());
|
||||
|
||||
if (!isPaused)
|
||||
{
|
||||
if (delta >= 0)
|
||||
{
|
||||
for (int i=0, n=objects.size(); i<n; i++) objects[i]->update(delta);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i=objects.size()-1; i>=0; i--) objects[i]->update(delta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of managed objects. An object may be a tween or a
|
||||
* timeline. Note that a timeline only counts for 1 object, since it
|
||||
* manages its children itself.
|
||||
* <p/>
|
||||
* To get the count of running tweens, see {@link #getRunningTweensCount()}.
|
||||
*/
|
||||
int TweenManager::size() { return objects.size(); }
|
||||
|
||||
/**
|
||||
* Gets the number of running tweens. This number includes the tweens
|
||||
* located inside timelines (and nested timelines).
|
||||
* <p/>
|
||||
* <b>Provided for debug purpose only.</b>
|
||||
*/
|
||||
int TweenManager::getRunningTweensCount() { return getTweensCount(objects); }
|
||||
|
||||
/**
|
||||
* Gets the number of running timelines. This number includes the timelines
|
||||
* nested inside other timelines.
|
||||
* <p/>
|
||||
* <b>Provided for debug purpose only.</b>
|
||||
*/
|
||||
int TweenManager::getRunningTimelinesCount() { return getTimelinesCount(objects); }
|
||||
|
||||
/**
|
||||
* Gets a list of every managed object.
|
||||
* <p/>
|
||||
* <b>Provided for debug purpose only.</b>
|
||||
*/
|
||||
std::vector<BaseTween *> &TweenManager::getObjects()
|
||||
{
|
||||
return objects;
|
||||
}
|
||||
|
||||
}
|
17
external/tween-engine/src/TweenPaths.cpp
vendored
17
external/tween-engine/src/TweenPaths.cpp
vendored
@ -1,17 +0,0 @@
|
||||
//
|
||||
// TweenPaths.cpp
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#include <TweenEngine/TweenPaths.h>
|
||||
|
||||
#include <TweenEngine/paths/LinearPath.h>
|
||||
#include <TweenEngine/paths/CatmullRom.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
TweenPath &TweenPaths::linear = *(new LinearPath());
|
||||
TweenPath &TweenPaths::catmullRom = *(new CatmullRom());
|
||||
}
|
39
external/tween-engine/src/TweenPool.cpp
vendored
39
external/tween-engine/src/TweenPool.cpp
vendored
@ -1,39 +0,0 @@
|
||||
//
|
||||
// TweenPool.cpp
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#include <TweenEngine/TweenPool.h>
|
||||
#include <TweenEngine/Tween.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
void TweenPoolCallback::onPool(Tween *obj)
|
||||
{
|
||||
obj->reset();
|
||||
}
|
||||
|
||||
void TweenPoolCallback::onUnPool(Tween *obj)
|
||||
{
|
||||
obj->reset();
|
||||
}
|
||||
|
||||
TweenPool::TweenPool() : Pool<TweenEngine::Tween>(20, new TweenPoolCallback())
|
||||
{
|
||||
}
|
||||
|
||||
Tween *TweenPool::create() { return new Tween(); }
|
||||
|
||||
//TweenPoolCallback *Tween::poolCallback = new TweenPoolCallback();
|
||||
//TweenPool *Tween::pool = new TweenPool(20, Tween::poolCallback);
|
||||
|
||||
/*
|
||||
private static final Pool<Tween> pool = new Pool<Tween>(20, poolCallback) {
|
||||
@Override protected Tween create() {return new Tween();}
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
}
|
34
external/tween-engine/src/equations/Back.cpp
vendored
34
external/tween-engine/src/equations/Back.cpp
vendored
@ -1,34 +0,0 @@
|
||||
//
|
||||
// Back.cpp
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#include <TweenEngine/equations/Back.h>
|
||||
|
||||
#define S (1.70158f)
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
float BackIn::compute(float t) { return t*t*((S+1)*t - S); }
|
||||
const char *BackIn::toString() { return "Back.IN"; }
|
||||
|
||||
float BackOut::compute(float t) {
|
||||
t -= 1;
|
||||
return (t*t*((S+1)*t + S) + 1);
|
||||
}
|
||||
const char *BackOut::toString() { return "Back.OUT"; }
|
||||
|
||||
float BackInOut::compute(float t) {
|
||||
float s=S*1.525;
|
||||
t*=2;
|
||||
if (t < 1) {
|
||||
return 0.5f*(t*t*((s+1)*t - s));
|
||||
} else {
|
||||
t -= 2;
|
||||
return 0.5f*(t*t*((s+1)*t + s) + 2);
|
||||
}
|
||||
}
|
||||
const char *BackInOut::toString() { return "Back.INOUT"; }
|
||||
}
|
42
external/tween-engine/src/equations/Bounce.cpp
vendored
42
external/tween-engine/src/equations/Bounce.cpp
vendored
@ -1,42 +0,0 @@
|
||||
//
|
||||
// Bounce.cpp
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#include <TweenEngine/equations/Bounce.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
inline float outBounce(float t) {
|
||||
if (t < (1/2.75)) {
|
||||
return 7.5625f*t*t;
|
||||
} else if (t < (2/2.75)) {
|
||||
t = t - (1.5 / 2.75);
|
||||
return (7.5625 * t * t + 0.75);
|
||||
} else if (t < (2.5/2.75)) {
|
||||
t = t - (2.25 / 2.75);
|
||||
return (7.5625 * t * t + 0.9375);
|
||||
} else {
|
||||
t = t - (2.625 / 2.75);
|
||||
return (7.5625 * t * t + 0.984375);
|
||||
}
|
||||
}
|
||||
|
||||
inline float inBounce(float t) {
|
||||
return 1 - outBounce(1-t);
|
||||
}
|
||||
|
||||
float BounceIn::compute(float t) { return inBounce(t); }
|
||||
const char *BounceIn::toString() { return "Bounce.IN"; }
|
||||
|
||||
float BounceOut::compute(float t) { return outBounce(t); }
|
||||
const char *BounceOut::toString() { return "Bounce.OUT"; }
|
||||
|
||||
float BounceInOut::compute(float t) {
|
||||
if (t < 0.5f) return (inBounce(t*2) * 0.5f);
|
||||
else return (outBounce(t*2-1) * 0.5f + 0.5f);
|
||||
}
|
||||
const char *BounceInOut::toString() { return "Bounce.INOUT"; }
|
||||
}
|
30
external/tween-engine/src/equations/Circ.cpp
vendored
30
external/tween-engine/src/equations/Circ.cpp
vendored
@ -1,30 +0,0 @@
|
||||
//
|
||||
// Circ.cpp
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#include <math.h>
|
||||
#include <TweenEngine/equations/Circ.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
float CircIn::compute(float t) { return (float) -sqrt(1 - t*t) - 1; }
|
||||
const char *CircIn::toString() { return "Circ.IN"; }
|
||||
|
||||
float CircOut::compute(float t) { return (float) sqrt(1 - (t-1)*(t-1)); }
|
||||
const char *CircOut::toString() { return "Circ.OUT"; }
|
||||
|
||||
float CircInOut::compute(float t) {
|
||||
t *= 2;
|
||||
if (t < 1) {
|
||||
return (-0.5 * (sqrt(1 - t*t) - 1));
|
||||
} else {
|
||||
t -= 2;
|
||||
return (0.5 * (sqrt(1 - t*t) + 1));
|
||||
}
|
||||
}
|
||||
|
||||
const char *CircInOut::toString() { return "Circ.INOUT"; }
|
||||
}
|
31
external/tween-engine/src/equations/Cubic.cpp
vendored
31
external/tween-engine/src/equations/Cubic.cpp
vendored
@ -1,31 +0,0 @@
|
||||
//
|
||||
// Cubic.cpp
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#include <TweenEngine/equations/Cubic.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
float CubicIn::compute(float t) { return t*t*t; }
|
||||
const char *CubicIn::toString() { return "Cubic.IN"; }
|
||||
|
||||
float CubicOut::compute(float t) {
|
||||
t -= 1;
|
||||
return t*t*t + 1;
|
||||
}
|
||||
const char *CubicOut::toString() { return "Cubic.OUT"; }
|
||||
|
||||
float CubicInOut::compute(float t) {
|
||||
t *= 2;
|
||||
if (t < 1) {
|
||||
return 0.5f * t*t*t;
|
||||
} else {
|
||||
t -= 2;
|
||||
return 0.5f * (t*t*t + 2);
|
||||
}
|
||||
}
|
||||
const char *CubicInOut::toString() { return "Cubic.INOUT"; }
|
||||
}
|
80
external/tween-engine/src/equations/Elastic.cpp
vendored
80
external/tween-engine/src/equations/Elastic.cpp
vendored
@ -1,80 +0,0 @@
|
||||
//
|
||||
// Elastic.cpp
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#include <math.h>
|
||||
#include <TweenEngine/equations/Elastic.h>
|
||||
|
||||
#define M_PI 3.14159265358979323846
|
||||
#define M_TWOPI (M_PI * 2.0)
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
float ElasticIn::compute(float t) {
|
||||
float a = amplitude;
|
||||
float p = period;
|
||||
if (t == 0) return 0;
|
||||
if (t == 1) return 1;
|
||||
if (!isPeriodSet) p = 0.3;
|
||||
float s;
|
||||
if (!isAmplitudeSet || a < 1) {
|
||||
a = 1;
|
||||
s = p/4.0;
|
||||
} else {
|
||||
s = p/(M_TWOPI) * (float)asin(1/a);
|
||||
}
|
||||
t -= 1;
|
||||
return -(a*(float)pow(2,10*t) * (float)sin((t-s)*(M_TWOPI)/p ));
|
||||
}
|
||||
const char *ElasticIn::toString() { return "Elastic.IN"; }
|
||||
void ElasticIn::setAmplitude(float a) { this->amplitude = a; this->isAmplitudeSet = true; }
|
||||
void ElasticIn::setPeriod(float p) { this->period = p; this->isPeriodSet = true; }
|
||||
|
||||
float ElasticOut::compute(float t) {
|
||||
float a = amplitude;
|
||||
float p = period;
|
||||
if (t==0) return 0;
|
||||
if (t==1) return 1;
|
||||
if (!isPeriodSet) p = 0.3f;
|
||||
float s;
|
||||
if (!isAmplitudeSet || a < 1) {
|
||||
a = 1;
|
||||
s = p/4.0;
|
||||
} else {
|
||||
s = p/(M_TWOPI) * (float)asin(1/a);
|
||||
}
|
||||
return a*(float)pow(2,-10*t) * (float)sin((t-s)*(M_TWOPI)/p ) + 1;
|
||||
}
|
||||
const char *ElasticOut::toString() { return "Elastic.OUT"; }
|
||||
void ElasticOut::setAmplitude(float a) { this->amplitude = a; this->isAmplitudeSet = true; }
|
||||
void ElasticOut::setPeriod(float p) { this->period = p; this->isPeriodSet = true; }
|
||||
|
||||
float ElasticInOut::compute(float t) {
|
||||
float a = amplitude;
|
||||
float p = period;
|
||||
if (t==0) return 0;
|
||||
t *= 2;
|
||||
if (t==2) return 1;
|
||||
if (!isPeriodSet) p = 0.3f*1.5f;
|
||||
float s;
|
||||
if (!isAmplitudeSet || a < 1) {
|
||||
a = 1;
|
||||
s = p/4.0;
|
||||
} else {
|
||||
s = p/(M_TWOPI) * (float)asin(1/a);
|
||||
}
|
||||
if (t < 1) {
|
||||
t -= 1;
|
||||
return -0.5f*(a*(float)pow(2,10*t) * (float)sin((t-s)*(M_TWOPI)/p));
|
||||
} else {
|
||||
t -= 1;
|
||||
return a*(float)pow(2,-10*t) * (float)sin((t-s)*(M_TWOPI)/p)*0.5f + 1;
|
||||
}
|
||||
}
|
||||
const char *ElasticInOut::toString() { return "Elastic.INOUT"; }
|
||||
void ElasticInOut::setAmplitude(float a) { this->amplitude = a; this->isAmplitudeSet = true; }
|
||||
void ElasticInOut::setPeriod(float p) { this->period = p; this->isPeriodSet = true; }
|
||||
}
|
35
external/tween-engine/src/equations/Expo.cpp
vendored
35
external/tween-engine/src/equations/Expo.cpp
vendored
@ -1,35 +0,0 @@
|
||||
//
|
||||
// Expo.cpp
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#include <math.h>
|
||||
#include <TweenEngine/equations/Expo.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
float ExpoIn::compute(float t) {
|
||||
return (t==0) ? 0 : (float)pow(2,10*(t-1));
|
||||
}
|
||||
const char *ExpoIn::toString() { return "Expo.IN"; }
|
||||
|
||||
float ExpoOut::compute(float t) {
|
||||
return (t==1) ? 1 : -(float)pow(2,-10*t) + 1;
|
||||
}
|
||||
const char *ExpoOut::toString() { return "Expo.OUT"; }
|
||||
|
||||
float ExpoInOut::compute(float t) {
|
||||
if (t==0) return 0;
|
||||
if (t==1) return 1;
|
||||
t *= 2;
|
||||
if (t < 1) {
|
||||
return 0.5f * (float)pow(2,10*(t-1));
|
||||
} else {
|
||||
t -= 1;
|
||||
return 0.5f * (-(float)pow(2,-10*t) + 2);
|
||||
}
|
||||
}
|
||||
const char *ExpoInOut::toString() { return "Expo.INOUT"; }
|
||||
}
|
20
external/tween-engine/src/equations/Linear.cpp
vendored
20
external/tween-engine/src/equations/Linear.cpp
vendored
@ -1,20 +0,0 @@
|
||||
//
|
||||
// Linear.cpp
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
/**
|
||||
* Easing equation based on Robert Penner's work:
|
||||
* http://robertpenner.com/easing/
|
||||
* @author Aurelien Ribon | http://www.aurelienribon.com/
|
||||
*/
|
||||
|
||||
#include <TweenEngine/equations/Linear.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
float LinearInOut::compute(float t) { return t; }
|
||||
const char *LinearInOut::toString() { return "Linear.INOUT"; }
|
||||
|
||||
}
|
31
external/tween-engine/src/equations/Quad.cpp
vendored
31
external/tween-engine/src/equations/Quad.cpp
vendored
@ -1,31 +0,0 @@
|
||||
//
|
||||
// Quad.cpp
|
||||
//
|
||||
// This code is derived from Universal Tween Engine
|
||||
// Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
/**
|
||||
* Easing equation based on Robert Penner's work:
|
||||
* http://robertpenner.com/easing/
|
||||
* @author Aurelien Ribon | http://www.aurelienribon.com/
|
||||
*/
|
||||
|
||||
#include <TweenEngine/equations/Quad.h>
|
||||
|
||||
namespace TweenEngine
|
||||
{
|
||||
float QuadIn::compute(float t) { return t*t; }
|
||||
const char *QuadIn::toString() { return "Quad.IN"; }
|
||||
|
||||
float QuadOut::compute(float t) { return -t*(t-2); }
|
||||
const char *QuadOut::toString() { return "Quad.OUT"; }
|
||||
|
||||
float QuadInOut::compute(float t)
|
||||
{
|
||||
t*=2;
|
||||
if (t < 1) return 0.5f*t*t;
|
||||
return -0.5f * ((t-1)*(t-3) - 1);
|
||||
}
|
||||
const char *QuadInOut::toString() { return "Quad.INOUT"; }
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user