Skip to content

Add rectangles_intersect usage example - #797

Open
rachelpatrao wants to merge 1 commit into
thoth-tech:mainfrom
rachelpatrao:rectangles-intersect-usage-example
Open

Add rectangles_intersect usage example#797
rachelpatrao wants to merge 1 commit into
thoth-tech:mainfrom
rachelpatrao:rectangles-intersect-usage-example

Conversation

@rachelpatrao

Copy link
Copy Markdown

Description

Splashkit Function: rectangles_intersect

Overview of example functionality: Demonstrates how to use rectangles_intersect to detect whether two rectangles overlap. One rectangle remains fixed while the other follows the mouse cursor, changing the rectangle colours and displayed message when an intersection occurs.

Example Output: rectangles_intersect-1-example.gif showing the rectangles changing colour when they intersect.

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 Splashkit function above
  • Code does not use non-Splashkit functions
  • Code does not use extra function declarations or extra classes
  • Code does not violate any of the Thoth Tech SplashKit Style Guide rules
  • Simple, clear demonstration of the function
  • Tested in Chrome and Firefox

@netlify

netlify Bot commented Jul 30, 2026

Copy link
Copy Markdown

Deploy Preview for splashkit failed.

Name Link
🔨 Latest commit 68b3193
🔍 Latest deploy log https://app.netlify.com/projects/splashkit/deploys/6a6ae500add75c000848ce27

@AAMIRAU AAMIRAU left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hi Rachel, the example is clear and the implementations are consistent across C++, C# top-level and C# OOP. The GIF also demonstrates the intersection behaviour well. Before approval, could you please verify the Python colour and text-drawing API calls, and confirm whether the generated usage-example-references.json file should be excluded from the PR?

@rachelpatrao

Copy link
Copy Markdown
Author

@AAMIRAU Thanks for reviewing the example! I've double-checked the Python implementation and confirmed that the colour constants and draw_text call are correct and consistent with the equivalent C++, C# top-level, and C# OOP examples. I also confirmed that usage-example-references.json is required, as it registers the new usage example so it appears in the documentation, so I've kept that in the PR. Thanks again for the feedback!

@AAMIRAU

AAMIRAU commented Aug 3, 2026

Copy link
Copy Markdown

sorry for the delay

@ralphweng2023 ralphweng2023 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Picking up the two things AAMIRAU raised on the 30th, since both are still live.

The Python file cannot run as committed. COLOR_WHITE and the other four colours are C++ defines, Python spells them color_white() and so on, so line 24 raises before anything is drawn. fill_rectangle is passed two arguments where the Python binding wants five, the two argument form is fill_rectangle_record, and draw_text is passed four where it wants six, which is draw_text_no_font_no_size.

The telling part is the references JSON. It lists color_white and draw_text_no_font_no_size among the functions used, and the committed .py calls neither, so that file was generated from a working version which did not make it into the commit. Please commit that version instead, and drop the JSON since the scraper rebuilds it.

movable_rectangle
)

clear_screen(COLOR_WHITE)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same swap applies to the other four colours.

Suggested change
clear_screen(COLOR_WHITE)
clear_screen(color_white())

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.

3 participants