Skip to content

Add current_window usage example#775

Open
ZGT23 wants to merge 1 commit into
thoth-tech:mainfrom
ZGT23:feature/current-window-usage-example
Open

Add current_window usage example#775
ZGT23 wants to merge 1 commit into
thoth-tech:mainfrom
ZGT23:feature/current-window-usage-example

Conversation

@ZGT23
Copy link
Copy Markdown

@ZGT23 ZGT23 commented May 17, 2026

Description

Splashkit Function: current_window

Overview of example functionality:
This pull request adds a beginner-friendly usage example for the current_window function in the Windows category.

The example opens a SplashKit window, retrieves the currently active window using current_window(), and stores it in a window variable. It then uses that window object to display the window caption, width, height, and current window status. A blue rectangle is also drawn in the window to visually demonstrate that drawing and refreshing can be performed using the current window object.

This example helps beginners understand how to work with SplashKit window objects instead of only relying on general screen-level drawing functions.

Files Included

  • C++ code
  • C# code (Top-Level statements)
  • C# code (Object-Oriented Programming)
  • Python code
  • Relevant title for the example (.txt)
  • Screenshot

Usage Example Checks

  • Code uses the SplashKit function above
  • Code does not use non-SplashKit functions
  • Code does not use extra function declarations or extra classes
  • Simple, clear demonstration of the function
  • Tested C++ version locally in MSYS2
  • Tested Python version locally in MSYS2

How Has This Been Tested?

The example was tested locally to confirm that:

  • The window opens correctly
  • current_window() returns the active SplashKit window
  • The window caption, width, height, and current window status are displayed correctly
  • The blue rectangle and text are drawn correctly in the current window
  • C++ version runs correctly in MSYS2
  • Python version runs correctly in MSYS2

Testing Checklist

  • C++ example tested locally
  • Python example tested locally
  • Tested in latest Chrome
  • Tested in latest Firefox
  • npm run preview

Folders and Files Added/Modified

  • Added:
    • public/usage-examples/windows/current_window-1-example.cpp
    • public/usage-examples/windows/current_window-1-example-top-level.cs
    • public/usage-examples/windows/current_window-1-example-oop.cs
    • public/usage-examples/windows/current_window-1-example.py
    • public/usage-examples/windows/current_window-1-example.txt
    • public/usage-examples/windows/current_window-1-example.png

Additional Notes

This example is designed to be simple and beginner-friendly. It focuses on demonstrating how current_window() can be used to retrieve and work with the active window object in SplashKit.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 17, 2026

Deploy Preview for splashkit failed.

Name Link
🔨 Latest commit 060d955
🔍 Latest deploy log https://app.netlify.com/projects/splashkit/deploys/6a097f89466f9f0008bb8dcb

Copy link
Copy Markdown

@RUNQILIU-123 RUNQILIU-123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. This is a useful and easy-to-follow usage example for current_window. The example clearly shows how to retrieve the active window object and use it to access the window caption, size, and current window status. The visual rectangle and text output also make the example more understandable for beginners. The added C++, C#, Python, title, and screenshot files look consistent with the expected structure. Good work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants