diff --git a/public/usage-examples/utilities/replace_all-1-example-oop.cs b/public/usage-examples/utilities/replace_all-1-example-oop.cs new file mode 100644 index 000000000..aa4fce6c0 --- /dev/null +++ b/public/usage-examples/utilities/replace_all-1-example-oop.cs @@ -0,0 +1,16 @@ +using SplashKitSDK; + +public class Program +{ + public static void Main() + { + // Store the sentence to update + string text = "foo is here, foo is there, foo is everywhere."; + + // Replace every "foo" with "bar" + string result = SplashKit.ReplaceAll(text, "foo", "bar"); + + // Show the updated sentence + SplashKit.WriteLine(result); + } +} \ No newline at end of file diff --git a/public/usage-examples/utilities/replace_all-1-example-top-level.cs b/public/usage-examples/utilities/replace_all-1-example-top-level.cs new file mode 100644 index 000000000..fa2ea4d70 --- /dev/null +++ b/public/usage-examples/utilities/replace_all-1-example-top-level.cs @@ -0,0 +1,10 @@ +using SplashKitSDK; + +// Store the sentence to update +string text = "foo is here, foo is there, foo is everywhere."; + +// Replace every "foo" with "bar" +string result = SplashKit.ReplaceAll(text, "foo", "bar"); + +// Show the updated sentence +SplashKit.WriteLine(result); \ No newline at end of file diff --git a/public/usage-examples/utilities/replace_all-1-example.cpp b/public/usage-examples/utilities/replace_all-1-example.cpp new file mode 100644 index 000000000..c179bb2d4 --- /dev/null +++ b/public/usage-examples/utilities/replace_all-1-example.cpp @@ -0,0 +1,16 @@ +#include "splashkit.h" +using namespace std; + +int main() +{ + // Store the sentence to update + string text = "foo is here, foo is there, foo is everywhere."; + + // Replace every "foo" with "bar" + string result = replace_all(text, "foo", "bar"); + + // Show the updated sentence + write_line(result); + + return 0; +} \ No newline at end of file diff --git a/public/usage-examples/utilities/replace_all-1-example.png b/public/usage-examples/utilities/replace_all-1-example.png new file mode 100644 index 000000000..8003cfa93 Binary files /dev/null and b/public/usage-examples/utilities/replace_all-1-example.png differ diff --git a/public/usage-examples/utilities/replace_all-1-example.py b/public/usage-examples/utilities/replace_all-1-example.py new file mode 100644 index 000000000..1ec07a123 --- /dev/null +++ b/public/usage-examples/utilities/replace_all-1-example.py @@ -0,0 +1,10 @@ +from splashkit import * + +# Store the sentence to update +text = "foo is here, foo is there, foo is everywhere." + +# Replace every "foo" with "bar" +result = replace_all(text, "foo", "bar") + +# Show the updated sentence +write_line(result) \ No newline at end of file diff --git a/public/usage-examples/utilities/replace_all-1-example.txt b/public/usage-examples/utilities/replace_all-1-example.txt new file mode 100644 index 000000000..37880f63e --- /dev/null +++ b/public/usage-examples/utilities/replace_all-1-example.txt @@ -0,0 +1 @@ +Replace all occurrences of one word in a sentence \ No newline at end of file diff --git a/scripts/json-files/guides-groups.json b/scripts/json-files/guides-groups.json index 7fe7bccde..3f1385eaa 100644 --- a/scripts/json-files/guides-groups.json +++ b/scripts/json-files/guides-groups.json @@ -1,10 +1,10 @@ [ + "Camera", + "Graphics", "animations", "audio", "beyond-splashkit", - "camera", "color", - "graphics", "input", "interface", "json", diff --git a/scripts/json-files/usage-example-references.json b/scripts/json-files/usage-example-references.json index c41688ec6..65dd0a17e 100644 --- a/scripts/json-files/usage-example-references.json +++ b/scripts/json-files/usage-example-references.json @@ -38,6 +38,31 @@ ] } ], + "color": [ + { + "funcKey": "saturation_of", + "title": "Draws a rectangle in a random colour. The colour's saturation value is displayed on screen", + "url": "/api/color/#saturation-of", + "functions": [ + "open_window", + "random_rgb_color", + "round", + "rectangle_from", + "clear_screen", + "color_white", + "fill_rectangle_record", + "draw_text_no_font_no_size", + "color_black", + "red_of", + "green_of", + "blue_of", + "alpha_of", + "refresh_screen", + "delay", + "close_all_windows" + ] + } + ], "geometry": [ { "funcKey": "center_point", @@ -524,6 +549,32 @@ "close_window" ] }, + { + "funcKey": "rectangle_around", + "title": "A perpetually moving circle which increases and decreases in size, surrounded by a rectangle shape", + "url": "/api/geometry/#rectangle-around", + "functions": [ + "open_window", + "create_timer", + "start_timer", + "quit_requested", + "point_at", + "cosine", + "sine", + "circle_at", + "timer_ticks", + "reset_timer", + "process_events", + "clear_screen_to_white", + "draw_rectangle_record", + "color_black", + "rectangle_around_circle", + "fill_circle_record", + "color_red", + "refresh_screen", + "close_all_windows" + ] + }, { "funcKey": "same_point", "title": "Point 2D Guessing Game", @@ -561,6 +612,24 @@ "close_all_windows" ] }, + { + "funcKey": "bitmap_center", + "title": "Draw a bitmap with a red dot at its center\r", + "url": "/api/graphics/#bitmap-center", + "functions": [ + "open_window", + "load_bitmap", + "clear_screen", + "color_white", + "draw_bitmap", + "fill_circle_record", + "color_red", + "circle_at", + "refresh_screen", + "delay", + "close_all_windows" + ] + }, { "funcKey": "clear_screen", "title": "Background Color", @@ -597,6 +666,26 @@ "SplashKit" ] }, + { + "funcKey": "draw_circle", + "title": "Circle Showcase", + "url": "/api/graphics/#draw-circle", + "functions": [ + "open_window", + "clear_screen", + "color_white", + "fill_circle", + "color_red", + "color_blue", + "color_green", + "color_orange", + "color_purple", + "random_rgb_color", + "refresh_screen", + "delay", + "close_all_windows" + ] + }, { "funcKey": "draw_circle_on_bitmap", "title": "Creating a Red Planet", @@ -1189,6 +1278,25 @@ "close_all_windows" ] }, + { + "funcKey": "get_font_style", + "title": "The program automatically cycles through font styles for a given font (also displaying example text), with the numerical value of each style being shown on screen\r", + "url": "/api/graphics/#get-font-style", + "functions": [ + "open_window", + "font_named", + "quit_requested", + "process_events", + "set_font_style", + "clear_screen_to_white", + "draw_text_no_font_no_size", + "color_black", + "draw_text", + "refresh_screen", + "delay", + "close_all_windows" + ] + }, { "funcKey": "has_font", "title": "Checking for Font using Variable", @@ -1730,6 +1838,14 @@ "write_line" ] }, + { + "funcKey": "replace_all", + "title": "Replacing all occurrences of a word in a sentence", + "url": "/api/utilities/#replace-all", + "functions": [ + "print" + ] + }, { "funcKey": "rnd", "title": "Coin Flip", @@ -1790,5 +1906,30 @@ "write_line" ] } + ], + "windows": [ + { + "funcKey": "close_window", + "title": "Starts a countdown to close the window at the push of a button.", + "url": "/api/windows/#close-window", + "functions": [ + "open_window", + "create_timer", + "quit_requested", + "process_events", + "clear_window", + "color_white", + "button_at_position", + "rectangle_from", + "start_timer", + "draw_text_font_as_string", + "color_black", + "timer_ticks", + "reset_timer", + "draw_interface", + "refresh_window", + "close_all_windows" + ] + } ] } \ No newline at end of file