diff --git a/public/usage-examples/windows/current_window-1-example-oop.cs b/public/usage-examples/windows/current_window-1-example-oop.cs new file mode 100644 index 000000000..2c5f7428d --- /dev/null +++ b/public/usage-examples/windows/current_window-1-example-oop.cs @@ -0,0 +1,39 @@ +using SplashKitSDK; + +namespace CurrentWindowExample +{ + public static class Program + { + public static void Main() + { + Window displayWindow = SplashKit.OpenWindow("Current Window Example", 800, 600); + + while (!SplashKit.QuitRequested()) + { + SplashKit.ProcessEvents(); + + displayWindow = SplashKit.CurrentWindow(); + + int width = SplashKit.WindowWidth(displayWindow); + int height = SplashKit.WindowHeight(displayWindow); + string caption = SplashKit.WindowCaption(displayWindow); + string currentStatus = SplashKit.IsCurrentWindow(displayWindow).ToString(); + + SplashKit.ClearWindow(displayWindow, Color.White); + + SplashKit.DrawText("Using current_window()", Color.Black, 20, 20); + SplashKit.DrawText("Caption: " + caption, Color.Black, 20, 60); + SplashKit.DrawText("Window Width: " + width, Color.Black, 20, 100); + SplashKit.DrawText("Window Height: " + height, Color.Black, 20, 140); + SplashKit.DrawText("Is Current Window: " + currentStatus, Color.Black, 20, 180); + + SplashKit.FillRectangle(Color.Blue, 20, 230, width - 40, 80); + SplashKit.DrawText("This rectangle is drawn in the current window.", Color.White, 40, 260); + + SplashKit.RefreshWindow(displayWindow, 60U); + } + + SplashKit.CloseWindow(displayWindow); + } + } +} \ No newline at end of file diff --git a/public/usage-examples/windows/current_window-1-example-top-level.cs b/public/usage-examples/windows/current_window-1-example-top-level.cs new file mode 100644 index 000000000..bf224aa99 --- /dev/null +++ b/public/usage-examples/windows/current_window-1-example-top-level.cs @@ -0,0 +1,31 @@ +using SplashKitSDK; +using static SplashKitSDK.SplashKit; + +Window displayWindow = OpenWindow("Current Window Example", 800, 600); + +while (!QuitRequested()) +{ + ProcessEvents(); + + displayWindow = CurrentWindow(); + + int width = WindowWidth(displayWindow); + int height = WindowHeight(displayWindow); + string caption = WindowCaption(displayWindow); + string currentStatus = IsCurrentWindow(displayWindow).ToString(); + + ClearWindow(displayWindow, ColorWhite()); + + DrawText("Using current_window()", ColorBlack(), 20, 20); + DrawText("Caption: " + caption, ColorBlack(), 20, 60); + DrawText("Window Width: " + width, ColorBlack(), 20, 100); + DrawText("Window Height: " + height, ColorBlack(), 20, 140); + DrawText("Is Current Window: " + currentStatus, ColorBlack(), 20, 180); + + FillRectangle(ColorBlue(), 20, 230, width - 40, 80); + DrawText("This rectangle is drawn in the current window.", ColorWhite(), 40, 260); + + RefreshWindow(displayWindow, 60U); +} + +CloseWindow(displayWindow); \ No newline at end of file diff --git a/public/usage-examples/windows/current_window-1-example.cpp b/public/usage-examples/windows/current_window-1-example.cpp new file mode 100644 index 000000000..23776c737 --- /dev/null +++ b/public/usage-examples/windows/current_window-1-example.cpp @@ -0,0 +1,36 @@ +#include "splashkit.h" +#include + +int main() +{ + window display_window = open_window("Current Window Example", 800, 600); + + while (!quit_requested()) + { + process_events(); + + display_window = current_window(); + + int width = window_width(display_window); + int height = window_height(display_window); + string caption = window_caption(display_window); + string current_status = is_current_window(display_window) ? "true" : "false"; + + clear_window(display_window, COLOR_WHITE); + + draw_text("Using current_window()", COLOR_BLACK, 20, 20); + draw_text("Caption: " + caption, COLOR_BLACK, 20, 60); + draw_text("Window Width: " + std::to_string(width), COLOR_BLACK, 20, 100); + draw_text("Window Height: " + std::to_string(height), COLOR_BLACK, 20, 140); + draw_text("Is Current Window: " + current_status, COLOR_BLACK, 20, 180); + + fill_rectangle(COLOR_BLUE, 20, 230, width - 40, 80); + draw_text("This rectangle is drawn in the current window.", COLOR_WHITE, 40, 260); + + refresh_window(display_window, 60); + } + + close_window(display_window); + + return 0; +} \ No newline at end of file diff --git a/public/usage-examples/windows/current_window-1-example.png b/public/usage-examples/windows/current_window-1-example.png new file mode 100644 index 000000000..9513023b5 Binary files /dev/null and b/public/usage-examples/windows/current_window-1-example.png differ diff --git a/public/usage-examples/windows/current_window-1-example.py b/public/usage-examples/windows/current_window-1-example.py new file mode 100644 index 000000000..76236bada --- /dev/null +++ b/public/usage-examples/windows/current_window-1-example.py @@ -0,0 +1,28 @@ +from splashkit import * + +display_window = open_window("Current Window Example", 800, 600) + +while not quit_requested(): + process_events() + + display_window = current_window() + + width = window_width(display_window) + height = window_height(display_window) + caption = window_caption(display_window) + current_status = str(is_current_window(display_window)) + + clear_window(display_window, color_white()) + + draw_text_no_font_no_size("Using current_window()", color_black(), 20, 20) + draw_text_no_font_no_size("Caption: " + caption, color_black(), 20, 60) + draw_text_no_font_no_size("Window Width: " + str(width), color_black(), 20, 100) + draw_text_no_font_no_size("Window Height: " + str(height), color_black(), 20, 140) + draw_text_no_font_no_size("Is Current Window: " + current_status, color_black(), 20, 180) + + fill_rectangle(color_blue(), 20, 230, width - 40, 80) + draw_text_no_font_no_size("This rectangle is drawn in the current window.", color_white(), 40, 260) + + refresh_window_with_target_fps(display_window, 60) + +close_window(display_window) \ No newline at end of file diff --git a/public/usage-examples/windows/current_window-1-example.txt b/public/usage-examples/windows/current_window-1-example.txt new file mode 100644 index 000000000..9a3d9d70f --- /dev/null +++ b/public/usage-examples/windows/current_window-1-example.txt @@ -0,0 +1 @@ +Using the Current Window Object \ No newline at end of file