diff --git a/public/usage-examples/animations/animation_ended-1-example-oop.cs b/public/usage-examples/animations/animation_ended-1-example-oop.cs new file mode 100644 index 000000000..59094efca --- /dev/null +++ b/public/usage-examples/animations/animation_ended-1-example-oop.cs @@ -0,0 +1,33 @@ +using SplashKitSDK; + +namespace AnimationEndedExample +{ + public class Program + { + public static void Main() + { + AnimationScript script = SplashKit.LoadAnimationScript("ExplosionScript", "explosion.txt"); + Animation anim = SplashKit.CreateAnimation(script, "explosion"); + + SplashKit.WriteLine("Has animation ended?"); + SplashKit.WriteLine(SplashKit.AnimationEnded(anim).ToString()); + + for (int i = 0; i < 10; i++) + { + SplashKit.UpdateAnimation(anim); + SplashKit.Delay(100); + + SplashKit.WriteLine("Current cell: " + SplashKit.AnimationCurrentCell(anim).ToString()); + + if (SplashKit.AnimationEnded(anim)) + { + SplashKit.WriteLine("Animation ended!"); + break; + } + } + + SplashKit.FreeAnimation(anim); + SplashKit.FreeAnimationScript(script); + } + } +} diff --git a/public/usage-examples/animations/animation_ended-1-example-top-level.cs b/public/usage-examples/animations/animation_ended-1-example-top-level.cs new file mode 100644 index 000000000..ecbdd8022 --- /dev/null +++ b/public/usage-examples/animations/animation_ended-1-example-top-level.cs @@ -0,0 +1,24 @@ +using static SplashKitSDK.SplashKit; + +AnimationScript script = LoadAnimationScript("ExplosionScript", "explosion.txt"); +Animation anim = CreateAnimation(script, "explosion"); + +WriteLine("Has animation ended?"); +WriteLine(AnimationEnded(anim).ToString()); + +for (int i = 0; i < 10; i++) +{ + UpdateAnimation(anim); + Delay(100); + + WriteLine("Current cell: " + AnimationCurrentCell(anim).ToString()); + + if (AnimationEnded(anim)) + { + WriteLine("Animation ended!"); + break; + } +} + +FreeAnimation(anim); +FreeAnimationScript(script); diff --git a/public/usage-examples/animations/animation_ended-1-example.cpp b/public/usage-examples/animations/animation_ended-1-example.cpp new file mode 100644 index 000000000..90c4d1f1a --- /dev/null +++ b/public/usage-examples/animations/animation_ended-1-example.cpp @@ -0,0 +1,29 @@ +#include "splashkit.h" + +int main() +{ + animation_script script = load_animation_script("ExplosionScript", "explosion.txt"); + animation anim = create_animation(script, "explosion"); + + write_line("Has animation ended?"); + write_line(animation_ended(anim) ? "true" : "false"); + + for (int i = 0; i < 10; i++) + { + update_animation(anim); + delay(100); + + write_line("Current cell: " + std::to_string(animation_current_cell(anim))); + + if (animation_ended(anim)) + { + write_line("Animation ended!"); + break; + } + } + + free_animation(anim); + free_animation_script(script); + + return 0; +} diff --git a/public/usage-examples/animations/animation_ended-1-example.png b/public/usage-examples/animations/animation_ended-1-example.png new file mode 100644 index 000000000..f4129076d Binary files /dev/null and b/public/usage-examples/animations/animation_ended-1-example.png differ diff --git a/public/usage-examples/animations/animation_ended-1-example.py b/public/usage-examples/animations/animation_ended-1-example.py new file mode 100644 index 000000000..7ebbe9467 --- /dev/null +++ b/public/usage-examples/animations/animation_ended-1-example.py @@ -0,0 +1,21 @@ +from splashkit import * + +script = load_animation_script("ExplosionScript", "explosion.txt") +anim = create_animation(script, "explosion") + +print("Has animation ended?") +print(animation_ended(anim)) + +for _ in range(10): + update_animation(anim) + delay(100) + + print("Current cell:") + print(animation_current_cell(anim)) + + if animation_ended(anim): + print("Animation ended!") + break + +free_animation(anim) +free_animation_script(script) diff --git a/public/usage-examples/animations/animation_ended-1-example.txt b/public/usage-examples/animations/animation_ended-1-example.txt new file mode 100644 index 000000000..bf2852fc7 --- /dev/null +++ b/public/usage-examples/animations/animation_ended-1-example.txt @@ -0,0 +1,5 @@ +Animation Ended Check + +:::note +To test this example code you can download these [**Resources**](/resources/guides/animation/basics/BasicAnimationResources.zip). +::: diff --git a/public/usage-examples/animations/animation_entered_frame-1-example-oop.cs b/public/usage-examples/animations/animation_entered_frame-1-example-oop.cs new file mode 100644 index 000000000..d8401a47f --- /dev/null +++ b/public/usage-examples/animations/animation_entered_frame-1-example-oop.cs @@ -0,0 +1,30 @@ +using SplashKitSDK; + +namespace AnimationEnteredFrameExample +{ + public class Program + { + public static void Main() + { + AnimationScript script = SplashKit.LoadAnimationScript("WalkingScript", "kermit.txt"); + Animation anim = SplashKit.CreateAnimation(script, "WalkFront"); + + SplashKit.WriteLine("Updating animation and checking frame entry..."); + + for (int i = 0; i < 10; i++) + { + SplashKit.UpdateAnimation(anim); + SplashKit.Delay(100); + + if (SplashKit.AnimationEnteredFrame(anim)) + { + SplashKit.WriteLine("Entered a new frame!"); + SplashKit.WriteLine("Current cell: " + SplashKit.AnimationCurrentCell(anim).ToString()); + } + } + + SplashKit.FreeAnimation(anim); + SplashKit.FreeAnimationScript(script); + } + } +} diff --git a/public/usage-examples/animations/animation_entered_frame-1-example-top-level.cs b/public/usage-examples/animations/animation_entered_frame-1-example-top-level.cs new file mode 100644 index 000000000..2a7d98ad9 --- /dev/null +++ b/public/usage-examples/animations/animation_entered_frame-1-example-top-level.cs @@ -0,0 +1,21 @@ +using static SplashKitSDK.SplashKit; + +AnimationScript script = LoadAnimationScript("WalkingScript", "kermit.txt"); +Animation anim = CreateAnimation(script, "WalkFront"); + +WriteLine("Updating animation and checking frame entry..."); + +for (int i = 0; i < 10; i++) +{ + UpdateAnimation(anim); + Delay(100); + + if (AnimationEnteredFrame(anim)) + { + WriteLine("Entered a new frame!"); + WriteLine("Current cell: " + AnimationCurrentCell(anim).ToString()); + } +} + +FreeAnimation(anim); +FreeAnimationScript(script); diff --git a/public/usage-examples/animations/animation_entered_frame-1-example.cpp b/public/usage-examples/animations/animation_entered_frame-1-example.cpp new file mode 100644 index 000000000..481d61aa1 --- /dev/null +++ b/public/usage-examples/animations/animation_entered_frame-1-example.cpp @@ -0,0 +1,26 @@ +#include "splashkit.h" + +int main() +{ + animation_script script = load_animation_script("WalkingScript", "kermit.txt"); + animation anim = create_animation(script, "WalkFront"); + + write_line("Updating animation and checking frame entry..."); + + for (int i = 0; i < 10; i++) + { + update_animation(anim); + delay(100); + + if (animation_entered_frame(anim)) + { + write_line("Entered a new frame!"); + write_line("Current cell: " + std::to_string(animation_current_cell(anim))); + } + } + + free_animation(anim); + free_animation_script(script); + + return 0; +} diff --git a/public/usage-examples/animations/animation_entered_frame-1-example.png b/public/usage-examples/animations/animation_entered_frame-1-example.png new file mode 100644 index 000000000..ec0a4c99e Binary files /dev/null and b/public/usage-examples/animations/animation_entered_frame-1-example.png differ diff --git a/public/usage-examples/animations/animation_entered_frame-1-example.py b/public/usage-examples/animations/animation_entered_frame-1-example.py new file mode 100644 index 000000000..3e7ccd049 --- /dev/null +++ b/public/usage-examples/animations/animation_entered_frame-1-example.py @@ -0,0 +1,18 @@ +from splashkit import * + +script = load_animation_script("WalkingScript", "kermit.txt") +anim = create_animation(script, "WalkFront") + +print("Updating animation and checking frame entry...") + +for _ in range(10): + update_animation(anim) + delay(100) + + if animation_entered_frame(anim): + print("Entered a new frame!") + print("Current cell:") + print(animation_current_cell(anim)) + +free_animation(anim) +free_animation_script(script) diff --git a/public/usage-examples/animations/animation_entered_frame-1-example.txt b/public/usage-examples/animations/animation_entered_frame-1-example.txt new file mode 100644 index 000000000..66aca0c27 --- /dev/null +++ b/public/usage-examples/animations/animation_entered_frame-1-example.txt @@ -0,0 +1,5 @@ +Animation Frame Entry Detection + +:::note +To test this example code you can download these [**Resources**](/resources/guides/animation/basics/BasicAnimationResources.zip). +::: diff --git a/public/usage-examples/animations/animation_frame_time-1-example-oop.cs b/public/usage-examples/animations/animation_frame_time-1-example-oop.cs new file mode 100644 index 000000000..a1d53a0fe --- /dev/null +++ b/public/usage-examples/animations/animation_frame_time-1-example-oop.cs @@ -0,0 +1,26 @@ +using SplashKitSDK; + +namespace AnimationFrameTimeExample +{ + public class Program + { + public static void Main() + { + AnimationScript script = SplashKit.LoadAnimationScript("WalkingScript", "kermit.txt"); + Animation anim = SplashKit.CreateAnimation(script, "WalkFront"); + + SplashKit.WriteLine("Frame time in current frame:"); + + for (int i = 0; i < 5; i++) + { + SplashKit.UpdateAnimation(anim); + SplashKit.Delay(200); + + SplashKit.WriteLine("Frame time: " + SplashKit.AnimationFrameTime(anim).ToString()); + } + + SplashKit.FreeAnimation(anim); + SplashKit.FreeAnimationScript(script); + } + } +} diff --git a/public/usage-examples/animations/animation_frame_time-1-example-top-level.cs b/public/usage-examples/animations/animation_frame_time-1-example-top-level.cs new file mode 100644 index 000000000..6d2a112cc --- /dev/null +++ b/public/usage-examples/animations/animation_frame_time-1-example-top-level.cs @@ -0,0 +1,17 @@ +using static SplashKitSDK.SplashKit; + +AnimationScript script = LoadAnimationScript("WalkingScript", "kermit.txt"); +Animation anim = CreateAnimation(script, "WalkFront"); + +WriteLine("Frame time in current frame:"); + +for (int i = 0; i < 5; i++) +{ + UpdateAnimation(anim); + Delay(200); + + WriteLine("Frame time: " + AnimationFrameTime(anim).ToString()); +} + +FreeAnimation(anim); +FreeAnimationScript(script); diff --git a/public/usage-examples/animations/animation_frame_time-1-example.cpp b/public/usage-examples/animations/animation_frame_time-1-example.cpp new file mode 100644 index 000000000..79d81ebba --- /dev/null +++ b/public/usage-examples/animations/animation_frame_time-1-example.cpp @@ -0,0 +1,22 @@ +#include "splashkit.h" + +int main() +{ + animation_script script = load_animation_script("WalkingScript", "kermit.txt"); + animation anim = create_animation(script, "WalkFront"); + + write_line("Frame time in current frame:"); + + for (int i = 0; i < 5; i++) + { + update_animation(anim); + delay(200); + + write_line("Frame time: " + std::to_string(animation_frame_time(anim))); + } + + free_animation(anim); + free_animation_script(script); + + return 0; +} diff --git a/public/usage-examples/animations/animation_frame_time-1-example.png b/public/usage-examples/animations/animation_frame_time-1-example.png new file mode 100644 index 000000000..e34422236 Binary files /dev/null and b/public/usage-examples/animations/animation_frame_time-1-example.png differ diff --git a/public/usage-examples/animations/animation_frame_time-1-example.py b/public/usage-examples/animations/animation_frame_time-1-example.py new file mode 100644 index 000000000..e6fc4b390 --- /dev/null +++ b/public/usage-examples/animations/animation_frame_time-1-example.py @@ -0,0 +1,15 @@ +from splashkit import * + +script = load_animation_script("WalkingScript", "kermit.txt") +anim = create_animation(script, "WalkFront") + +print("Frame time in current frame:") + +for _ in range(5): + update_animation(anim) + delay(200) + + print(animation_frame_time(anim)) + +free_animation(anim) +free_animation_script(script) diff --git a/public/usage-examples/animations/animation_frame_time-1-example.txt b/public/usage-examples/animations/animation_frame_time-1-example.txt new file mode 100644 index 000000000..85729475b --- /dev/null +++ b/public/usage-examples/animations/animation_frame_time-1-example.txt @@ -0,0 +1,5 @@ +Animation Frame Time Display + +:::note +To test this example code you can download these [**Resources**](/resources/guides/animation/basics/BasicAnimationResources.zip). +::: diff --git a/public/usage-examples/animations/create_animation-1-example-oop.cs b/public/usage-examples/animations/create_animation-1-example-oop.cs new file mode 100644 index 000000000..e12d5712a --- /dev/null +++ b/public/usage-examples/animations/create_animation-1-example-oop.cs @@ -0,0 +1,21 @@ +using SplashKitSDK; + +namespace CreateAnimationExample +{ + public class Program + { + public static void Main() + { + AnimationScript script = SplashKit.LoadAnimationScript("WalkingScript", "kermit.txt"); + + SplashKit.WriteLine("Creating animation..."); + Animation anim = SplashKit.CreateAnimation(script, "WalkFront"); + + SplashKit.WriteLine("Animation name:"); + SplashKit.WriteLine(SplashKit.AnimationName(anim)); + + SplashKit.FreeAnimation(anim); + SplashKit.FreeAnimationScript(script); + } + } +} diff --git a/public/usage-examples/animations/create_animation-1-example-top-level.cs b/public/usage-examples/animations/create_animation-1-example-top-level.cs new file mode 100644 index 000000000..dc76d50f9 --- /dev/null +++ b/public/usage-examples/animations/create_animation-1-example-top-level.cs @@ -0,0 +1,12 @@ +using static SplashKitSDK.SplashKit; + +AnimationScript script = LoadAnimationScript("WalkingScript", "kermit.txt"); + +WriteLine("Creating animation..."); +Animation anim = CreateAnimation(script, "WalkFront"); + +WriteLine("Animation name:"); +WriteLine(AnimationName(anim)); + +FreeAnimation(anim); +FreeAnimationScript(script); diff --git a/public/usage-examples/animations/create_animation-1-example.cpp b/public/usage-examples/animations/create_animation-1-example.cpp new file mode 100644 index 000000000..e1acb2732 --- /dev/null +++ b/public/usage-examples/animations/create_animation-1-example.cpp @@ -0,0 +1,17 @@ +#include "splashkit.h" + +int main() +{ + animation_script script = load_animation_script("WalkingScript", "kermit.txt"); + + write_line("Creating animation..."); + animation anim = create_animation(script, "WalkFront"); + + write_line("Animation name:"); + write_line(animation_name(anim)); + + free_animation(anim); + free_animation_script(script); + + return 0; +} diff --git a/public/usage-examples/animations/create_animation-1-example.png b/public/usage-examples/animations/create_animation-1-example.png new file mode 100644 index 000000000..7a5c9ef01 Binary files /dev/null and b/public/usage-examples/animations/create_animation-1-example.png differ diff --git a/public/usage-examples/animations/create_animation-1-example.py b/public/usage-examples/animations/create_animation-1-example.py new file mode 100644 index 000000000..2a94789d5 --- /dev/null +++ b/public/usage-examples/animations/create_animation-1-example.py @@ -0,0 +1,12 @@ +from splashkit import * + +script = load_animation_script("WalkingScript", "kermit.txt") + +print("Creating animation...") +anim = create_animation(script, "WalkFront") + +print("Animation name:") +print(animation_name(anim)) + +free_animation(anim) +free_animation_script(script) diff --git a/public/usage-examples/animations/create_animation-1-example.txt b/public/usage-examples/animations/create_animation-1-example.txt new file mode 100644 index 000000000..ed8892ef0 --- /dev/null +++ b/public/usage-examples/animations/create_animation-1-example.txt @@ -0,0 +1,5 @@ +Animation Creation Demo + +:::note +To test this example code you can download these [**Resources**](/resources/guides/animation/basics/BasicAnimationResources.zip). +::: diff --git a/public/usage-examples/animations/free_animation-1-example-oop.cs b/public/usage-examples/animations/free_animation-1-example-oop.cs new file mode 100644 index 000000000..93bacc512 --- /dev/null +++ b/public/usage-examples/animations/free_animation-1-example-oop.cs @@ -0,0 +1,18 @@ +using SplashKitSDK; + +namespace FreeAnimationExample +{ + public class Program + { + public static void Main() + { + AnimationScript script = SplashKit.LoadAnimationScript("WalkingScript", "kermit.txt"); + Animation anim = SplashKit.CreateAnimation(script, "WalkFront"); + + SplashKit.WriteLine("Freeing animation: " + SplashKit.AnimationName(anim)); + SplashKit.FreeAnimation(anim); + + SplashKit.FreeAnimationScript(script); + } + } +} diff --git a/public/usage-examples/animations/free_animation-1-example-top-level.cs b/public/usage-examples/animations/free_animation-1-example-top-level.cs new file mode 100644 index 000000000..a3079e614 --- /dev/null +++ b/public/usage-examples/animations/free_animation-1-example-top-level.cs @@ -0,0 +1,9 @@ +using static SplashKitSDK.SplashKit; + +AnimationScript script = LoadAnimationScript("WalkingScript", "kermit.txt"); +Animation anim = CreateAnimation(script, "WalkFront"); + +WriteLine("Freeing animation: " + AnimationName(anim)); +FreeAnimation(anim); + +FreeAnimationScript(script); diff --git a/public/usage-examples/animations/free_animation-1-example.cpp b/public/usage-examples/animations/free_animation-1-example.cpp new file mode 100644 index 000000000..639c23800 --- /dev/null +++ b/public/usage-examples/animations/free_animation-1-example.cpp @@ -0,0 +1,13 @@ +#include "splashkit.h" + +int main() +{ + animation_script script = load_animation_script("WalkingScript", "kermit.txt"); + animation anim = create_animation(script, "WalkFront"); + + write_line("Freeing animation: " + animation_name(anim)); + free_animation(anim); + + free_animation_script(script); + return 0; +} diff --git a/public/usage-examples/animations/free_animation-1-example.png b/public/usage-examples/animations/free_animation-1-example.png new file mode 100644 index 000000000..265f6f8bd Binary files /dev/null and b/public/usage-examples/animations/free_animation-1-example.png differ diff --git a/public/usage-examples/animations/free_animation-1-example.py b/public/usage-examples/animations/free_animation-1-example.py new file mode 100644 index 000000000..3eb638cac --- /dev/null +++ b/public/usage-examples/animations/free_animation-1-example.py @@ -0,0 +1,9 @@ +from splashkit import * + +script = load_animation_script("WalkingScript", "kermit.txt") +anim = create_animation(script, "WalkFront") + +print("Freeing animation: " + animation_name(anim)) +free_animation(anim) + +free_animation_script(script) diff --git a/public/usage-examples/animations/free_animation-1-example.txt b/public/usage-examples/animations/free_animation-1-example.txt new file mode 100644 index 000000000..a7b8aedc3 --- /dev/null +++ b/public/usage-examples/animations/free_animation-1-example.txt @@ -0,0 +1,5 @@ +Freeing an Animation + +:::note +To test this example code you can download these [**Resources**](/resources/guides/animation/basics/BasicAnimationResources.zip). +::: diff --git a/public/usage-examples/animations/free_animation_script-1-example-oop.cs b/public/usage-examples/animations/free_animation_script-1-example-oop.cs new file mode 100644 index 000000000..6824fe394 --- /dev/null +++ b/public/usage-examples/animations/free_animation_script-1-example-oop.cs @@ -0,0 +1,15 @@ +using SplashKitSDK; + +namespace FreeAnimationScriptExample +{ + public class Program + { + public static void Main() + { + AnimationScript script = SplashKit.LoadAnimationScript("WalkingScript", "kermit.txt"); + + SplashKit.WriteLine("Freeing animation script: " + SplashKit.AnimationScriptName(script)); + SplashKit.FreeAnimationScript(script); + } + } +} diff --git a/public/usage-examples/animations/free_animation_script-1-example-top-level.cs b/public/usage-examples/animations/free_animation_script-1-example-top-level.cs new file mode 100644 index 000000000..5dec88398 --- /dev/null +++ b/public/usage-examples/animations/free_animation_script-1-example-top-level.cs @@ -0,0 +1,6 @@ +using static SplashKitSDK.SplashKit; + +AnimationScript script = LoadAnimationScript("WalkingScript", "kermit.txt"); + +WriteLine("Freeing animation script: " + AnimationScriptName(script)); +FreeAnimationScript(script); diff --git a/public/usage-examples/animations/free_animation_script-1-example.cpp b/public/usage-examples/animations/free_animation_script-1-example.cpp new file mode 100644 index 000000000..427d92376 --- /dev/null +++ b/public/usage-examples/animations/free_animation_script-1-example.cpp @@ -0,0 +1,11 @@ +#include "splashkit.h" + +int main() +{ + animation_script script = load_animation_script("WalkingScript", "kermit.txt"); + + write_line("Freeing animation script: " + animation_script_name(script)); + free_animation_script(script); + + return 0; +} diff --git a/public/usage-examples/animations/free_animation_script-1-example.png b/public/usage-examples/animations/free_animation_script-1-example.png new file mode 100644 index 000000000..875178d67 Binary files /dev/null and b/public/usage-examples/animations/free_animation_script-1-example.png differ diff --git a/public/usage-examples/animations/free_animation_script-1-example.py b/public/usage-examples/animations/free_animation_script-1-example.py new file mode 100644 index 000000000..795c82f60 --- /dev/null +++ b/public/usage-examples/animations/free_animation_script-1-example.py @@ -0,0 +1,6 @@ +from splashkit import * + +script = load_animation_script("WalkingScript", "kermit.txt") + +print("Freeing animation script: " + animation_script_name(script)) +free_animation_script(script) diff --git a/public/usage-examples/animations/free_animation_script-1-example.txt b/public/usage-examples/animations/free_animation_script-1-example.txt new file mode 100644 index 000000000..932ea2216 --- /dev/null +++ b/public/usage-examples/animations/free_animation_script-1-example.txt @@ -0,0 +1,5 @@ +Freeing an Animation Script + +:::note +To test this example code you can download these [**Resources**](/resources/guides/animation/basics/BasicAnimationResources.zip). +::: diff --git a/public/usage-examples/animations/load_animation_script-1-example-oop.cs b/public/usage-examples/animations/load_animation_script-1-example-oop.cs new file mode 100644 index 000000000..5acec9ccb --- /dev/null +++ b/public/usage-examples/animations/load_animation_script-1-example-oop.cs @@ -0,0 +1,21 @@ +using SplashKitSDK; + +namespace LoadAnimationScriptExample +{ + public class Program + { + public static void Main() + { + SplashKit.WriteLine("Loading animation script..."); + + AnimationScript script = SplashKit.LoadAnimationScript("WalkingScript", "kermit.txt"); + + SplashKit.WriteLine("Script name:"); + SplashKit.WriteLine(SplashKit.AnimationScriptName(script)); + + SplashKit.WriteLine("Animations in script: " + SplashKit.AnimationCount(script).ToString()); + + SplashKit.FreeAnimationScript(script); + } + } +} diff --git a/public/usage-examples/animations/load_animation_script-1-example-top-level.cs b/public/usage-examples/animations/load_animation_script-1-example-top-level.cs new file mode 100644 index 000000000..2b5c7ca06 --- /dev/null +++ b/public/usage-examples/animations/load_animation_script-1-example-top-level.cs @@ -0,0 +1,12 @@ +using static SplashKitSDK.SplashKit; + +WriteLine("Loading animation script..."); + +AnimationScript script = LoadAnimationScript("WalkingScript", "kermit.txt"); + +WriteLine("Script name:"); +WriteLine(AnimationScriptName(script)); + +WriteLine("Animations in script: " + AnimationCount(script).ToString()); + +FreeAnimationScript(script); diff --git a/public/usage-examples/animations/load_animation_script-1-example.cpp b/public/usage-examples/animations/load_animation_script-1-example.cpp new file mode 100644 index 000000000..487399ee0 --- /dev/null +++ b/public/usage-examples/animations/load_animation_script-1-example.cpp @@ -0,0 +1,16 @@ +#include "splashkit.h" + +int main() +{ + write_line("Loading animation script..."); + + animation_script script = load_animation_script("WalkingScript", "kermit.txt"); + + write_line("Script name:"); + write_line(animation_script_name(script)); + + write_line("Animations in script: " + std::to_string(animation_count(script))); + + free_animation_script(script); + return 0; +} diff --git a/public/usage-examples/animations/load_animation_script-1-example.png b/public/usage-examples/animations/load_animation_script-1-example.png new file mode 100644 index 000000000..875178d67 Binary files /dev/null and b/public/usage-examples/animations/load_animation_script-1-example.png differ diff --git a/public/usage-examples/animations/load_animation_script-1-example.py b/public/usage-examples/animations/load_animation_script-1-example.py new file mode 100644 index 000000000..a6863cd44 --- /dev/null +++ b/public/usage-examples/animations/load_animation_script-1-example.py @@ -0,0 +1,13 @@ +from splashkit import * + +print("Loading animation script...") + +script = load_animation_script("WalkingScript", "kermit.txt") + +print("Script name:") +print(animation_script_name(script)) + +print("Animations in script:") +print(animation_count(script)) + +free_animation_script(script) diff --git a/public/usage-examples/animations/load_animation_script-1-example.txt b/public/usage-examples/animations/load_animation_script-1-example.txt new file mode 100644 index 000000000..e07b110f9 --- /dev/null +++ b/public/usage-examples/animations/load_animation_script-1-example.txt @@ -0,0 +1,5 @@ +Load an Animation Script + +:::note +To test this example code you can download these [**Resources**](/resources/guides/animation/basics/BasicAnimationResources.zip). +::: diff --git a/public/usage-examples/animations/restart_animation-1-example-oop.cs b/public/usage-examples/animations/restart_animation-1-example-oop.cs new file mode 100644 index 000000000..9f6e400a4 --- /dev/null +++ b/public/usage-examples/animations/restart_animation-1-example-oop.cs @@ -0,0 +1,25 @@ +using SplashKitSDK; + +namespace RestartAnimationExample +{ + public class Program + { + public static void Main() + { + AnimationScript script = SplashKit.LoadAnimationScript("WalkingScript", "kermit.txt"); + Animation anim = SplashKit.CreateAnimation(script, "WalkFront"); + + SplashKit.WriteLine("Updating animation a few times..."); + for (int i = 0; i < 10; i++) + { + SplashKit.UpdateAnimation(anim); + } + + SplashKit.WriteLine("Restarting animation..."); + SplashKit.RestartAnimation(anim); + + SplashKit.FreeAnimation(anim); + SplashKit.FreeAnimationScript(script); + } + } +} diff --git a/public/usage-examples/animations/restart_animation-1-example-top-level.cs b/public/usage-examples/animations/restart_animation-1-example-top-level.cs new file mode 100644 index 000000000..3ebf2ed62 --- /dev/null +++ b/public/usage-examples/animations/restart_animation-1-example-top-level.cs @@ -0,0 +1,16 @@ +using static SplashKitSDK.SplashKit; + +AnimationScript script = LoadAnimationScript("WalkingScript", "kermit.txt"); +Animation anim = CreateAnimation(script, "WalkFront"); + +WriteLine("Updating animation a few times..."); +for (int i = 0; i < 10; i++) +{ + UpdateAnimation(anim); +} + +WriteLine("Restarting animation..."); +RestartAnimation(anim); + +FreeAnimation(anim); +FreeAnimationScript(script); diff --git a/public/usage-examples/animations/restart_animation-1-example.cpp b/public/usage-examples/animations/restart_animation-1-example.cpp new file mode 100644 index 000000000..ad858728f --- /dev/null +++ b/public/usage-examples/animations/restart_animation-1-example.cpp @@ -0,0 +1,20 @@ +#include "splashkit.h" + +int main() +{ + animation_script script = load_animation_script("WalkingScript", "kermit.txt"); + animation anim = create_animation(script, "WalkFront"); + + write_line("Updating animation a few times..."); + for (int i = 0; i < 10; i++) + { + update_animation(anim); + } + + write_line("Restarting animation..."); + restart_animation(anim); + + free_animation(anim); + free_animation_script(script); + return 0; +} diff --git a/public/usage-examples/animations/restart_animation-1-example.png b/public/usage-examples/animations/restart_animation-1-example.png new file mode 100644 index 000000000..13e936a4d Binary files /dev/null and b/public/usage-examples/animations/restart_animation-1-example.png differ diff --git a/public/usage-examples/animations/restart_animation-1-example.py b/public/usage-examples/animations/restart_animation-1-example.py new file mode 100644 index 000000000..d218495ca --- /dev/null +++ b/public/usage-examples/animations/restart_animation-1-example.py @@ -0,0 +1,14 @@ +from splashkit import * + +script = load_animation_script("WalkingScript", "kermit.txt") +anim = create_animation(script, "WalkFront") + +print("Updating animation a few times...") +for i in range(10): + update_animation(anim) + +print("Restarting animation...") +restart_animation(anim) + +free_animation(anim) +free_animation_script(script) diff --git a/public/usage-examples/animations/restart_animation-1-example.txt b/public/usage-examples/animations/restart_animation-1-example.txt new file mode 100644 index 000000000..3c87199f8 --- /dev/null +++ b/public/usage-examples/animations/restart_animation-1-example.txt @@ -0,0 +1,5 @@ +Restarting an Animation + +:::note +To test this example code you can download these [**Resources**](/resources/guides/animation/basics/BasicAnimationResources.zip). +::: diff --git a/public/usage-examples/animations/update_animation-1-example-oop.cs b/public/usage-examples/animations/update_animation-1-example-oop.cs new file mode 100644 index 000000000..7081f1a54 --- /dev/null +++ b/public/usage-examples/animations/update_animation-1-example-oop.cs @@ -0,0 +1,26 @@ +using SplashKitSDK; + +namespace UpdateAnimationExample +{ + public class Program + { + public static void Main() + { + AnimationScript script = SplashKit.LoadAnimationScript("WalkingScript", "kermit.txt"); + Animation anim = SplashKit.CreateAnimation(script, "WalkFront"); + + SplashKit.WriteLine("Updating animation..."); + + for (int i = 0; i < 5; i++) + { + SplashKit.UpdateAnimation(anim); + SplashKit.Delay(100); + + SplashKit.WriteLine("Current cell: " + SplashKit.AnimationCurrentCell(anim).ToString()); + } + + SplashKit.FreeAnimation(anim); + SplashKit.FreeAnimationScript(script); + } + } +} diff --git a/public/usage-examples/animations/update_animation-1-example-top-level.cs b/public/usage-examples/animations/update_animation-1-example-top-level.cs new file mode 100644 index 000000000..4f3b6886f --- /dev/null +++ b/public/usage-examples/animations/update_animation-1-example-top-level.cs @@ -0,0 +1,17 @@ +using static SplashKitSDK.SplashKit; + +AnimationScript script = LoadAnimationScript("WalkingScript", "kermit.txt"); +Animation anim = CreateAnimation(script, "WalkFront"); + +WriteLine("Updating animation..."); + +for (int i = 0; i < 5; i++) +{ + UpdateAnimation(anim); + Delay(100); + + WriteLine("Current cell: " + AnimationCurrentCell(anim).ToString()); +} + +FreeAnimation(anim); +FreeAnimationScript(script); diff --git a/public/usage-examples/animations/update_animation-1-example.cpp b/public/usage-examples/animations/update_animation-1-example.cpp new file mode 100644 index 000000000..63ee43442 --- /dev/null +++ b/public/usage-examples/animations/update_animation-1-example.cpp @@ -0,0 +1,22 @@ +#include "splashkit.h" + +int main() +{ + animation_script script = load_animation_script("WalkingScript", "kermit.txt"); + animation anim = create_animation(script, "WalkFront"); + + write_line("Updating animation..."); + + for (int i = 0; i < 5; i++) + { + update_animation(anim); + delay(100); + + write_line("Current cell: " + std::to_string(animation_current_cell(anim))); + } + + free_animation(anim); + free_animation_script(script); + + return 0; +} diff --git a/public/usage-examples/animations/update_animation-1-example.png b/public/usage-examples/animations/update_animation-1-example.png new file mode 100644 index 000000000..116459eed Binary files /dev/null and b/public/usage-examples/animations/update_animation-1-example.png differ diff --git a/public/usage-examples/animations/update_animation-1-example.py b/public/usage-examples/animations/update_animation-1-example.py new file mode 100644 index 000000000..9f7ba4145 --- /dev/null +++ b/public/usage-examples/animations/update_animation-1-example.py @@ -0,0 +1,16 @@ +from splashkit import * + +script = load_animation_script("WalkingScript", "kermit.txt") +anim = create_animation(script, "WalkFront") + +print("Updating animation...") + +for _ in range(5): + update_animation(anim) + delay(100) + + print("Current cell:") + print(animation_current_cell(anim)) + +free_animation(anim) +free_animation_script(script) diff --git a/public/usage-examples/animations/update_animation-1-example.txt b/public/usage-examples/animations/update_animation-1-example.txt new file mode 100644 index 000000000..9d6f580a3 --- /dev/null +++ b/public/usage-examples/animations/update_animation-1-example.txt @@ -0,0 +1,5 @@ +Updating Animation Frames + +:::note +To test this example code you can download these [**Resources**](/resources/guides/animation/basics/BasicAnimationResources.zip). +:::