diff --git a/public/usage-examples/graphics/free_all_fonts/free_all_fonts-1-simple-oop.cs b/public/usage-examples/graphics/free_all_fonts/free_all_fonts-1-simple-oop.cs new file mode 100644 index 00000000..13d877ee --- /dev/null +++ b/public/usage-examples/graphics/free_all_fonts/free_all_fonts-1-simple-oop.cs @@ -0,0 +1,43 @@ +using SplashKitSDK; + +public class Program +{ + public static void Main() + { + // Open a new window with the title "Free All Front" and dimensions 800x600 + SplashKit.OpenWindow("Free All Front", 800, 600); + + // Load the "Arial" font from the file "arial.ttf" + SplashKit.LoadFont("Arial", "arial.ttf"); + + // Draw text using the "Arial" font with the color black at position (100, 100) + SplashKit.DrawText("Old Theme", Color.Black, "Arial", 24, 100, 100); + + // Refresh the screen to display the text + SplashKit.RefreshScreen(); + + // Pause for 2000 milliseconds (2 seconds) to allow the text to be visible + SplashKit.Delay(2000); + + // Free all loaded fonts to reset the theme + SplashKit.FreeAllFonts(); + + // Clear the screen to prepare for the new theme + SplashKit.ClearScreen(); + + // Load the "Verdana" font from the file "verdana.ttf" + SplashKit.LoadFont("Verdana", "verdana.ttf"); + + // Draw text using the "Verdana" font with the color blue at position (100, 100) + SplashKit.DrawText("New Theme", Color.Blue, "Verdana", 24, 100, 100); + + // Refresh the screen to display the updated text + SplashKit.RefreshScreen(); + + // Pause for 3000 milliseconds (3 seconds) to allow the updated text to be visible + SplashKit.Delay(3000); + + // Close all open windows + SplashKit.CloseAllWindows(); + } +} diff --git a/public/usage-examples/graphics/free_all_fonts/free_all_fonts-1-simple-top-level.cs b/public/usage-examples/graphics/free_all_fonts/free_all_fonts-1-simple-top-level.cs new file mode 100644 index 00000000..4e2ea508 --- /dev/null +++ b/public/usage-examples/graphics/free_all_fonts/free_all_fonts-1-simple-top-level.cs @@ -0,0 +1,38 @@ +using SplashKitSDK; +using static SplashKitSDK.SplashKit; + + // Open a new window with the title "Free All Front" and dimensions 800x600 + OpenWindow("Free All Front", 800, 600); + + // Load the "Arial" font from the file "arial.ttf" + LoadFont("Arial", "arial.ttf"); + + // Draw text using the "Arial" font with the color black at position (100, 100) + DrawText("Old Theme", Color.Black, "Arial", 24, 100, 100); + + // Refresh the screen to display the text + RefreshScreen(); + + // Pause for 2000 milliseconds (2 seconds) to allow the text to be visible + Delay(2000); + + // Free all loaded fonts to reset the theme + FreeAllFonts(); + + // Clear the screen to prepare for the new theme + ClearScreen(); + + // Load the "Verdana" font from the file "verdana.ttf" + LoadFont("Verdana", "verdana.ttf"); + + // Draw text using the "Verdana" font with the color blue at position (100, 100) + DrawText("New Theme", Color.Blue, "Verdana", 24, 100, 100); + + // Refresh the screen to display the updated text + RefreshScreen(); + + // Pause for 3000 milliseconds (3 seconds) to allow the updated text to be visible + Delay(3000); + + // Close all open windows + CloseAllWindows(); diff --git a/public/usage-examples/graphics/free_all_fonts/free_all_fonts-1-simple.cpp b/public/usage-examples/graphics/free_all_fonts/free_all_fonts-1-simple.cpp new file mode 100644 index 00000000..d9559dfe --- /dev/null +++ b/public/usage-examples/graphics/free_all_fonts/free_all_fonts-1-simple.cpp @@ -0,0 +1,39 @@ +#include "splashkit.h" + +int main() +{ + // Open a window with the title "Free All Front" and dimensions 800x600 + open_window("Free All Front", 800, 600); + + // Load the "Arial" font from the file "arial.ttf" + load_font("Arial", "arial.ttf"); + + // Draw text "Old Theme" in black color using the "Arial" font at position (100, 100) + draw_text("Old Theme", COLOR_BLACK, "Arial", 24, 100, 100); + + // Refresh the screen to display the text + refresh_screen(); + + // Pause for 2000 milliseconds (2 seconds) to display the old theme + delay(2000); + + // Free all fonts to reset the theme + void free_all_fonts(); + + // Clear the screen to prepare for the new theme + clear_screen(); + + // Load the "Verdana" font from the file "verdana.ttf" + load_font("Verdana", "verdana.ttf"); + + // Draw text "New Theme" in blue color using the "Verdana" font at position (100, 100) + draw_text("New Theme", COLOR_BLUE, "Verdana", 24, 100, 100); + + // Refresh the screen to display the updated text + refresh_screen(); + + // Pause for 3000 milliseconds (3 seconds) to display the new theme + delay(3000); + + return 0; +} diff --git a/public/usage-examples/graphics/free_all_fonts/free_all_fonts-1-simple.png b/public/usage-examples/graphics/free_all_fonts/free_all_fonts-1-simple.png new file mode 100644 index 00000000..b8fc4d88 Binary files /dev/null and b/public/usage-examples/graphics/free_all_fonts/free_all_fonts-1-simple.png differ diff --git a/public/usage-examples/graphics/free_all_fonts/free_all_fonts-1-simple.py b/public/usage-examples/graphics/free_all_fonts/free_all_fonts-1-simple.py new file mode 100644 index 00000000..f78ad63e --- /dev/null +++ b/public/usage-examples/graphics/free_all_fonts/free_all_fonts-1-simple.py @@ -0,0 +1,37 @@ +from splashkit import * + +# Open a window with the title "Free All Front" and dimensions 800x600 +open_window("Free All Front", 800, 600) + +# Load the "Arial" font from the file "arial.ttf" +font1 = load_font("Arial", "arial.ttf") + +# Draw text using the "Arial" font with black color at position (100, 100) +draw_text("Old Theme", color_black(), font1, 24, 100, 100) + +# Refresh the screen to display the text +refresh_screen() + +# Pause for 2000 milliseconds (2 seconds) to display the old theme +delay(2000) + +# Free all loaded fonts to reset the theme +free_all_fonts() + +# Clear the screen and fill it with white color to prepare for the new theme +clear_screen(color_white()) + +# Load the "Verdana" font from the file "verdana.ttf" +font2 = load_font("Verdana", "verdana.ttf") + +# Draw text using the "Verdana" font with blue color at position (100, 100) +draw_text("New Theme", color_blue(), font2, 24, 100, 100) + +# Refresh the screen to display the updated text +refresh_screen() + +# Pause for 3000 milliseconds (3 seconds) to display the new theme +delay(3000) + +# Close all open windows +close_all_windows() diff --git a/public/usage-examples/graphics/free_all_fonts/free_all_fonts-1-simple.txt b/public/usage-examples/graphics/free_all_fonts/free_all_fonts-1-simple.txt new file mode 100644 index 00000000..b8fe0bd4 --- /dev/null +++ b/public/usage-examples/graphics/free_all_fonts/free_all_fonts-1-simple.txt @@ -0,0 +1,3 @@ +#### FREE ALL FONTS + +The following code shows an examples of using [Free all fonts](/api/graphics#free-all-fonts) to reset a program's theme by freeing all fonts and reloading a new font set. diff --git a/public/usage-examples/graphics/option_flip_x/option-flip-x-1-simple-oop.cs b/public/usage-examples/graphics/option_flip_x/option-flip-x-1-simple-oop.cs new file mode 100644 index 00000000..25a84daa --- /dev/null +++ b/public/usage-examples/graphics/option_flip_x/option-flip-x-1-simple-oop.cs @@ -0,0 +1,28 @@ +using SplashKitSDK; + +public class Program +{ + public static void Main() + { + // Open a new window with the title "OptionFlipX" and dimensions 800x600 + Window window = SplashKit.OpenWindow("Option Flip X ", 800, 600); + + // Load a bitmap image named "Player" from the file "character.png" + Bitmap bmp = SplashKit.LoadBitmap("Player", "character.png"); + + // Draw the original bitmap image at position (100, 100) in the window + SplashKit.DrawBitmap(bmp, 100, 100); + + // Draw the bitmap image flipped horizontally at position (300, 100) + SplashKit.DrawBitmap(bmp, 300, 100, SplashKit.OptionFlipX()); + + // Refresh the screen to display the drawings + SplashKit.RefreshScreen(); + + // Pause the program for 5000 milliseconds (5 seconds) to keep the window open + SplashKit.Delay(5000); + + // Close all open windows + SplashKit.CloseAllWindows(); + } +} diff --git a/public/usage-examples/graphics/option_flip_x/option-flip-x-1-simple-top-level.cs b/public/usage-examples/graphics/option_flip_x/option-flip-x-1-simple-top-level.cs new file mode 100644 index 00000000..93ffd08d --- /dev/null +++ b/public/usage-examples/graphics/option_flip_x/option-flip-x-1-simple-top-level.cs @@ -0,0 +1,24 @@ +using SplashKitSDK; +using static SplashKitSDK.SplashKit; + + // Open a new window with the title "OptionFlipX" and dimensions 800x600 + Window window = OpenWindow("Option Flip X ", 800, 600); + + // Load a bitmap image named "Player" from the file "character.png" + Bitmap bmp = LoadBitmap("Player", "character.png"); + + // Draw the original bitmap image at position (100, 100) in the window + DrawBitmap(bmp, 100, 100); + + // Draw the bitmap image flipped horizontally at position (300, 100) + DrawBitmap(bmp, 300, 100, OptionFlipX()); + + // Refresh the screen to display the drawings + RefreshScreen(); + + // Pause the program for 5000 milliseconds (5 seconds) to keep the window open + Delay(5000); + + // Close all open windows + CloseAllWindows(); + diff --git a/public/usage-examples/graphics/option_flip_x/option-flip-x-1-simple.cpp b/public/usage-examples/graphics/option_flip_x/option-flip-x-1-simple.cpp new file mode 100644 index 00000000..cad5929f --- /dev/null +++ b/public/usage-examples/graphics/option_flip_x/option-flip-x-1-simple.cpp @@ -0,0 +1,27 @@ +#include "splashkit.h" + +int main() +{ + // Open a window with the title "Option Flip X" and dimensions 800x600 + open_window("Option Flip X", 800, 600); + + // Load a bitmap image named "Player" from the file "character.png" + bitmap bmp = load_bitmap("Player", "character.png"); + + // Draw the original bitmap image at position (100, 100) + draw_bitmap(bmp, 100, 100); + + // Draw the bitmap image flipped both horizontally and vertically at position (300, 100) + draw_bitmap(bmp, 300, 100, option_flip_x()); + + // Refresh the screen to display the drawings + refresh_screen(); + + // Wait for 5 seconds before closing the window + delay(5000); + + // Close all open windows + close_all_windows(); + + return 0; +} diff --git a/public/usage-examples/graphics/option_flip_x/option-flip-x-1-simple.png b/public/usage-examples/graphics/option_flip_x/option-flip-x-1-simple.png new file mode 100644 index 00000000..cd9c7a72 Binary files /dev/null and b/public/usage-examples/graphics/option_flip_x/option-flip-x-1-simple.png differ diff --git a/public/usage-examples/graphics/option_flip_x/option-flip-x-1-simple.py b/public/usage-examples/graphics/option_flip_x/option-flip-x-1-simple.py new file mode 100644 index 00000000..aa90bec6 --- /dev/null +++ b/public/usage-examples/graphics/option_flip_x/option-flip-x-1-simple.py @@ -0,0 +1,22 @@ +from splashkit import * + +# Open a new window with the title "Option Flip X" and dimensions 800x600 +window = open_window("Option Flip X", 800, 600) + +# Load a bitmap image named "Player" from the file "character.png" +bmp = load_bitmap("Player", "character.png") + +# Draw the original bitmap image at position (100, 100) in the window +draw_bitmap(bmp, 100, 100) + +# Draw the bitmap image flipped vertically at position (300, 100) in the specified window +draw_bitmap_on_window_with_options(window, bmp, 300, 100, option_flip_xy()) + +# Refresh the screen to display the drawings +refresh_screen() + +# Pause the program for 5000 milliseconds (5 seconds) to keep the window open +delay(5000) + +# Close all open windows +close_all_windows() diff --git a/public/usage-examples/graphics/option_flip_x/option-flip-x-1-simple.txt b/public/usage-examples/graphics/option_flip_x/option-flip-x-1-simple.txt new file mode 100644 index 00000000..35d2c4ff --- /dev/null +++ b/public/usage-examples/graphics/option_flip_x/option-flip-x-1-simple.txt @@ -0,0 +1,3 @@ +#### Option Flip X + +The following code shows an examples of using [Option Flip X](/api/graphics#option-flip-x) to flipped version of a bitmap (e.g., a character image) along the X-axis, creating a mirror image effect next to the original. diff --git a/public/usage-examples/graphics/option_flip_x/option-flip-x-Resources.zip b/public/usage-examples/graphics/option_flip_x/option-flip-x-Resources.zip new file mode 100644 index 00000000..fb52852f Binary files /dev/null and b/public/usage-examples/graphics/option_flip_x/option-flip-x-Resources.zip differ diff --git a/public/usage-examples/graphics/option_flip_xy/option-flip-xy-1-simple-oop.cs b/public/usage-examples/graphics/option_flip_xy/option-flip-xy-1-simple-oop.cs new file mode 100644 index 00000000..8e299073 --- /dev/null +++ b/public/usage-examples/graphics/option_flip_xy/option-flip-xy-1-simple-oop.cs @@ -0,0 +1,28 @@ +using SplashKitSDK; + +public class Program +{ + public static void Main() + { + // Open a new window with the title "OptionFlipXY" and dimensions 800x600 + Window window = SplashKit.OpenWindow("Option Flip XY ", 800, 600); + + // Load a bitmap image named "House" from the file "house.png" + Bitmap bmp = SplashKit.LoadBitmap("House", "house.png"); + + // Draw the original bitmap image at position (100, 100) in the window + SplashKit.DrawBitmap(bmp, 100, 100); + + // Draw the bitmap image flipped horizontally at position (300, 100) + SplashKit.DrawBitmap(bmp, 300, 100, SplashKit.OptionFlipXy()); + + // Refresh the screen to display the drawings + SplashKit.RefreshScreen(); + + // Pause the program for 5000 milliseconds (5 seconds) to keep the window open + SplashKit.Delay(5000); + + // Close all open windows + SplashKit.CloseAllWindows(); + } +} diff --git a/public/usage-examples/graphics/option_flip_xy/option-flip-xy-1-simple-top-level.cs b/public/usage-examples/graphics/option_flip_xy/option-flip-xy-1-simple-top-level.cs new file mode 100644 index 00000000..a6db7180 --- /dev/null +++ b/public/usage-examples/graphics/option_flip_xy/option-flip-xy-1-simple-top-level.cs @@ -0,0 +1,24 @@ +using SplashKitSDK; +using static SplashKitSDK.SplashKit; + + // Open a new window with the title "OptionFlipXY" and dimensions 800x600 + Window window = OpenWindow("Option Flip XY ", 800, 600); + + // Load a bitmap image named "House" from the file "house.png" + Bitmap bmp = LoadBitmap("House", "house.png"); + + // Draw the original bitmap image at position (100, 100) in the window + DrawBitmap(bmp, 100, 100); + + // Draw the bitmap image flipped horizontally at position (300, 100) + DrawBitmap(bmp, 300, 100, OptionFlipXy()); + + // Refresh the screen to display the drawings + RefreshScreen(); + + // Pause the program for 5000 milliseconds (5 seconds) to keep the window open + Delay(5000); + + // Close all open windows + CloseAllWindows(); + diff --git a/public/usage-examples/graphics/option_flip_xy/option-flip-xy-1-simple.cpp b/public/usage-examples/graphics/option_flip_xy/option-flip-xy-1-simple.cpp new file mode 100644 index 00000000..3c2ce5aa --- /dev/null +++ b/public/usage-examples/graphics/option_flip_xy/option-flip-xy-1-simple.cpp @@ -0,0 +1,27 @@ +#include "splashkit.h" + +int main() +{ + // Open a window with the title "Option Flip XY" and dimensions 800x600 + open_window("Option Flip X", 800, 600); + + // Load a bitmap image named "House" from the file "house.png" + bitmap bmp = load_bitmap("House", "house.png"); + + // Draw the original bitmap image at position (100, 100) + draw_bitmap(bmp, 100, 100); + + // Draw the bitmap image flipped both horizontally and vertically at position (300, 100) + draw_bitmap(bmp, 300, 100, option_flip_xy()); + + // Refresh the screen to display the drawings + refresh_screen(); + + // Wait for 5 seconds before closing the window + delay(5000); + + // Close all open windows + close_all_windows(); + + return 0; +} diff --git a/public/usage-examples/graphics/option_flip_xy/option-flip-xy-1-simple.png b/public/usage-examples/graphics/option_flip_xy/option-flip-xy-1-simple.png new file mode 100644 index 00000000..fe5deded Binary files /dev/null and b/public/usage-examples/graphics/option_flip_xy/option-flip-xy-1-simple.png differ diff --git a/public/usage-examples/graphics/option_flip_xy/option-flip-xy-1-simple.py b/public/usage-examples/graphics/option_flip_xy/option-flip-xy-1-simple.py new file mode 100644 index 00000000..e24b174c --- /dev/null +++ b/public/usage-examples/graphics/option_flip_xy/option-flip-xy-1-simple.py @@ -0,0 +1,22 @@ +from splashkit import * + +# Open a new window with the title "Option Flip XY" and dimensions 800x600 +window = open_window("Option Flip XY", 800, 600) + +# Load a bitmap image named "House" from the file "house.png" +bmp = load_bitmap("House", "house.png") + +# Draw the original bitmap image at position (100, 100) in the window +draw_bitmap(bmp, 100, 100) + +# Draw the bitmap image flipped vertically at position (300, 100) in the specified window +draw_bitmap_on_window_with_options(window, bmp, 300, 100, option_flip_xy()) + +# Refresh the screen to display the drawings +refresh_screen() + +# Pause the program for 5000 milliseconds (5 seconds) to keep the window open +delay(5000) + +# Close all open windows +close_all_windows() diff --git a/public/usage-examples/graphics/option_flip_xy/option-flip-xy-1-simple.txt b/public/usage-examples/graphics/option_flip_xy/option-flip-xy-1-simple.txt new file mode 100644 index 00000000..42cf2662 --- /dev/null +++ b/public/usage-examples/graphics/option_flip_xy/option-flip-xy-1-simple.txt @@ -0,0 +1,4 @@ +#### Option Flip XY + +The following code shows an examples of using [Option Flip XY](/api/graphics#option-flip-xy) to draw a bitmap (e.g., a house image) with both X and Y flipped, creating an upside-down mirror version next to the original. + diff --git a/public/usage-examples/graphics/option_flip_xy/option-flip-xy-Resources.zip b/public/usage-examples/graphics/option_flip_xy/option-flip-xy-Resources.zip new file mode 100644 index 00000000..c437e701 Binary files /dev/null and b/public/usage-examples/graphics/option_flip_xy/option-flip-xy-Resources.zip differ diff --git a/public/usage-examples/graphics/option_flip_y/option-flip-y-1-simple-oop.cs b/public/usage-examples/graphics/option_flip_y/option-flip-y-1-simple-oop.cs new file mode 100644 index 00000000..69a4ca6f --- /dev/null +++ b/public/usage-examples/graphics/option_flip_y/option-flip-y-1-simple-oop.cs @@ -0,0 +1,28 @@ +using SplashKitSDK; + +public class Program +{ + public static void Main() + { + // Open a new window with the title "OptionFlipY Demo" and dimensions 800x600 + Window window = SplashKit.OpenWindow("Option Flip Y ", 800, 600); + + // Load a bitmap image named "Player" from the file "character.png" + Bitmap bmp = SplashKit.LoadBitmap("Landscape", "landscape.png"); + + // Draw the original bitmap image at position (100, 100) in the window + SplashKit.DrawBitmap(bmp, 100, 100); + + // Draw the bitmap image flipped horizontally at position (300, 100) + SplashKit.DrawBitmap(bmp, 300, 100, SplashKit.OptionFlipY()); + + // Refresh the screen to display the drawings + SplashKit.RefreshScreen(); + + // Pause the program for 5000 milliseconds (5 seconds) to keep the window open + SplashKit.Delay(5000); + + // Close all open windows + SplashKit.CloseAllWindows(); + } +} diff --git a/public/usage-examples/graphics/option_flip_y/option-flip-y-1-simple-top-level.cs b/public/usage-examples/graphics/option_flip_y/option-flip-y-1-simple-top-level.cs new file mode 100644 index 00000000..81194260 --- /dev/null +++ b/public/usage-examples/graphics/option_flip_y/option-flip-y-1-simple-top-level.cs @@ -0,0 +1,25 @@ +using SplashKitSDK; +using static SplashKitSDK.SplashKit; + + // Open a new window with the title "OptionFlipY Demo" and dimensions 800x600 + Window window = OpenWindow("Option Flip Y ", 800, 600); + + // Load a bitmap image named "Player" from the file "character.png" + Bitmap bmp = LoadBitmap("Landscape", "landscape.png"); + + // Draw the original bitmap image at position (100, 100) in the window + DrawBitmap(bmp, 100, 100); + + // Draw the bitmap image flipped horizontally at position (300, 100) + DrawBitmap(bmp, 300, 100, OptionFlipY()); + + // Refresh the screen to display the drawings + RefreshScreen(); + + // Pause the program for 5000 milliseconds (5 seconds) to keep the window open + Delay(5000); + + // Close all open windows + CloseAllWindows(); + + diff --git a/public/usage-examples/graphics/option_flip_y/option-flip-y-1-simple.cpp b/public/usage-examples/graphics/option_flip_y/option-flip-y-1-simple.cpp new file mode 100644 index 00000000..ac1c0689 --- /dev/null +++ b/public/usage-examples/graphics/option_flip_y/option-flip-y-1-simple.cpp @@ -0,0 +1,27 @@ +#include "splashkit.h" + +int main() +{ + // Open a window with the title "Option Flip Y" and dimensions 800x600 + open_window("Option Flip Y", 800, 600); + + // Load a bitmap image named "Landscape" from the file "landscape.png" + bitmap bmp = load_bitmap("Landscape", "landscape.png"); + + // Draw the original bitmap image at position (100, 100) + draw_bitmap(bmp, 100, 100); + + // Draw the bitmap image flipped both horizontally and vertically at position (300, 100) + draw_bitmap(bmp, 300, 100, option_flip_y()); + + // Refresh the screen to display the drawings + refresh_screen(); + + // Wait for 5 seconds before closing the window + delay(5000); + + // Close all open windows + close_all_windows(); + + return 0; +} diff --git a/public/usage-examples/graphics/option_flip_y/option-flip-y-1-simple.png b/public/usage-examples/graphics/option_flip_y/option-flip-y-1-simple.png new file mode 100644 index 00000000..fc2b3f9b Binary files /dev/null and b/public/usage-examples/graphics/option_flip_y/option-flip-y-1-simple.png differ diff --git a/public/usage-examples/graphics/option_flip_y/option-flip-y-1-simple.py b/public/usage-examples/graphics/option_flip_y/option-flip-y-1-simple.py new file mode 100644 index 00000000..f490a885 --- /dev/null +++ b/public/usage-examples/graphics/option_flip_y/option-flip-y-1-simple.py @@ -0,0 +1,22 @@ +from splashkit import * + +# Open a new window with the title "Option Flip Y" and dimensions 800x600 +window = open_window("Option Flip Y", 800, 600) + +# Load a bitmap image named "Landscape" from the file "landscape.png" +bmp = load_bitmap("Landscape", "landscape.png") + +# Draw the original bitmap image at position (100, 100) in the window +draw_bitmap(bmp, 100, 100) + +# Draw the bitmap image flipped vertically at position (300, 100) in the specified window +draw_bitmap_on_window_with_options(window, bmp, 300, 100, option_flip_y()) + +# Refresh the screen to display the drawings +refresh_screen() + +# Pause the program for 5000 milliseconds (5 seconds) to keep the window open +delay(5000) + +# Close all open windows +close_all_windows() diff --git a/public/usage-examples/graphics/option_flip_y/option-flip-y-1-simple.txt b/public/usage-examples/graphics/option_flip_y/option-flip-y-1-simple.txt new file mode 100644 index 00000000..7c3eb0dd --- /dev/null +++ b/public/usage-examples/graphics/option_flip_y/option-flip-y-1-simple.txt @@ -0,0 +1,4 @@ +#### Option Flip Y + +The following code shows an examples of using [Option Flip Y](/api/graphics#option-flip-y) to flip an image of a landscape along the Y-axis to create an upside-down reflection effect below the original. + diff --git a/public/usage-examples/graphics/option_flip_y/option-flip-y-Resources.zip b/public/usage-examples/graphics/option_flip_y/option-flip-y-Resources.zip new file mode 100644 index 00000000..96ea2f3b Binary files /dev/null and b/public/usage-examples/graphics/option_flip_y/option-flip-y-Resources.zip differ diff --git a/public/usage-examples/graphics/option_rotate_bmp/option-rotate-bmp-1-simple-oop.cs b/public/usage-examples/graphics/option_rotate_bmp/option-rotate-bmp-1-simple-oop.cs new file mode 100644 index 00000000..9046cf7b --- /dev/null +++ b/public/usage-examples/graphics/option_rotate_bmp/option-rotate-bmp-1-simple-oop.cs @@ -0,0 +1,41 @@ +using SplashKitSDK; + +public class Program +{ + public static void Main() + { + // Open a window with the title "Rotate bitmap" and dimensions 800x600 + SplashKit.OpenWindow("Rotate bitmap", 800, 600); + + // Load the bitmap for the clock hand from the file "clock_hand.png" + Bitmap bitmap = SplashKit.LoadBitmap("Clock Hand", "clock_hand.png"); + + // Load the bitmap for the clock face from the file "clock.png" + Bitmap clock = SplashKit.LoadBitmap("Clock", "clock.png"); + + // Loop to rotate the clock hand through 360 degrees + for (int i = 0; i < 360; i++) + { + // Draw the rotated clock hand bitmap at position (100, 100) + SplashKit.DrawBitmap(bitmap, 100, 100, SplashKit.OptionRotateBmp(i)); + + // Draw the clock face bitmap at the same position to create the effect of a rotating hand + SplashKit.DrawBitmap(clock, 100, 100); + + // Refresh the screen to display the updated frame + SplashKit.RefreshScreen(); + + // Pause for 100 milliseconds before the next frame + SplashKit.Delay(100); + + // Clear the screen to prepare for the next frame + SplashKit.ClearScreen(); + } + + // Free all loaded bitmap resources + SplashKit.FreeAllBitmaps(); + + // Close all open windows + SplashKit.CloseAllWindows(); + } +} diff --git a/public/usage-examples/graphics/option_rotate_bmp/option-rotate-bmp-1-simple-top-level.cs b/public/usage-examples/graphics/option_rotate_bmp/option-rotate-bmp-1-simple-top-level.cs new file mode 100644 index 00000000..afcacd76 --- /dev/null +++ b/public/usage-examples/graphics/option_rotate_bmp/option-rotate-bmp-1-simple-top-level.cs @@ -0,0 +1,38 @@ +using SplashKitSDK; +using static SplashKitSDK.SplashKit; + + // Open a window with the title "Rotate bitmap" and dimensions 800x600 + OpenWindow("Rotate bitmap", 800, 600); + + // Load the bitmap for the clock hand from the file "clock_hand.png" + Bitmap bitmap = LoadBitmap("Clock Hand", "clock_hand.png"); + + // Load the bitmap for the clock face from the file "clock.png" + Bitmap clock = LoadBitmap("Clock", "clock.png"); + + // Loop to rotate the clock hand through 360 degrees + for (int i = 0; i < 360; i++) + { + // Draw the rotated clock hand bitmap at position (100, 100) + DrawBitmap(bitmap, 100, 100, OptionRotateBmp(i)); + + // Draw the clock face bitmap at the same position to create the effect of a rotating hand + DrawBitmap(clock, 100, 100); + + // Refresh the screen to display the updated frame + RefreshScreen(); + + // Pause for 100 milliseconds before the next frame + Delay(100); + + // Clear the screen to prepare for the next frame + ClearScreen(); + } + + // Free all loaded bitmap resources + FreeAllBitmaps(); + + // Close all open windows + CloseAllWindows(); + + diff --git a/public/usage-examples/graphics/option_rotate_bmp/option-rotate-bmp-1-simple.cpp b/public/usage-examples/graphics/option_rotate_bmp/option-rotate-bmp-1-simple.cpp new file mode 100644 index 00000000..0d8120e6 --- /dev/null +++ b/public/usage-examples/graphics/option_rotate_bmp/option-rotate-bmp-1-simple.cpp @@ -0,0 +1,40 @@ +#include "splashkit.h" + +int main() +{ + // Open a window with the title "Rotate bitmap" and dimensions 800x600 + open_window("Rotate bitmap", 800, 600); + + // Load the bitmap for the clock hand from the file "clock_hand.png" + bitmap clockwise = load_bitmap("Clock Hand", "clock_hand.png"); + + // Load the bitmap for the clock face from the file "clock.png" + bitmap clock = load_bitmap("Clock", "clock.png"); + + // Loop to animate the rotation of the clock hand through 360 degrees + for (int i = 0; i < 360; i++) + { + // Draw the clock hand bitmap rotated to the current angle (i degrees) + draw_bitmap(clockwise, 100, 100, option_rotate_bmp(i)); + + // Draw the clock face bitmap at the same position to keep it static + draw_bitmap(clock, 100, 100); + + // Refresh the screen to update the display with the latest drawings + refresh_screen(); + + // Pause for 100 milliseconds to create a smooth animation effect + delay(100); + + // Clear the screen to remove the previous frame before drawing the next one + clear_screen(); + } + + // Free all loaded bitmap resources to prevent memory leaks + free_all_bitmaps(); + + // Close all open windows to end the program + close_all_windows(); + + return 0; +} diff --git a/public/usage-examples/graphics/option_rotate_bmp/option-rotate-bmp-1-simple.png b/public/usage-examples/graphics/option_rotate_bmp/option-rotate-bmp-1-simple.png new file mode 100644 index 00000000..0c9bd3d2 Binary files /dev/null and b/public/usage-examples/graphics/option_rotate_bmp/option-rotate-bmp-1-simple.png differ diff --git a/public/usage-examples/graphics/option_rotate_bmp/option-rotate-bmp-1-simple.py b/public/usage-examples/graphics/option_rotate_bmp/option-rotate-bmp-1-simple.py new file mode 100644 index 00000000..c29ac254 --- /dev/null +++ b/public/usage-examples/graphics/option_rotate_bmp/option-rotate-bmp-1-simple.py @@ -0,0 +1,33 @@ +from splashkit import * + +# Open the window with the title "Rotate bitmap" and dimensions 800x600 +open_window("Rotate bitmap", 800, 600) + +# Load the bitmap for the clock hand from the file "clock_hand.png" +clockwise = load_bitmap("Clock Hand", "clock_hand.png") + +# Load the bitmap for the clock face from the file "clock.png" +clock = load_bitmap("Clock", "clock.png") + +# Main loop to rotate the clock hand through 360 degrees +for i in range(360): + # Draw the clock hand bitmap rotated to the current angle (i degrees) + draw_bitmap_with_options(clockwise, 100, 100, option_rotate_bmp(i)) + + # Draw the clock face bitmap at the same position to keep it static + draw_bitmap(clock, 100, 100) + + # Refresh the screen to display the updated drawings + refresh_screen() + + # Pause for 100 milliseconds to create a smooth animation effect + delay(100) + + # Clear the screen with a white background before the next frame + clear_screen(color_white()) + +# Free all loaded bitmap resources to prevent memory leaks +free_all_bitmaps() + +# Close the window to end the program +close_all_windows() diff --git a/public/usage-examples/graphics/option_rotate_bmp/option-rotate-bmp-1-simple.txt b/public/usage-examples/graphics/option_rotate_bmp/option-rotate-bmp-1-simple.txt new file mode 100644 index 00000000..291e55a3 --- /dev/null +++ b/public/usage-examples/graphics/option_rotate_bmp/option-rotate-bmp-1-simple.txt @@ -0,0 +1,3 @@ +#### OPTION ROTATE BITMAP + +The following code shows an examples of using [Option Rotate Bitmap](/api/graphics#option-rotate-bitmap) to rotate a clock hand bitmap to different angles to simulate the movement of a clock. diff --git a/public/usage-examples/graphics/option_rotate_bmp/option-rotate-bmp-Resources.zip b/public/usage-examples/graphics/option_rotate_bmp/option-rotate-bmp-Resources.zip new file mode 100644 index 00000000..c5949d4d Binary files /dev/null and b/public/usage-examples/graphics/option_rotate_bmp/option-rotate-bmp-Resources.zip differ