Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions public/usage-examples/graphics/draw_circle-2-animation.cpp

This comment was marked as resolved.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "splashkit.h"

int main()
{
open_window("Circle Animation", 800, 600);

double x = 0;

while (!window_close_requested("Circle Animation"))
{
process_events();
clear_screen(COLOR_WHITE);

draw_circle(COLOR_RED, x, 300, 50);

x += 2;
if (x > 800) x = 0;

refresh_screen(60);
}

return 0;
}
17 changes: 17 additions & 0 deletions public/usage-examples/graphics/draw_circle-2-animation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from splashkit import *

window = open_window("Circle Animation", 800, 600)

x = 0

while not window_close_requested(window):
process_events()
clear_screen_to_white()

draw_circle(color_red(), x, 300, 50)

x += 2
if x > 800:
x = 0

refresh_screen_with_target_fps(60)
1 change: 1 addition & 0 deletions public/usage-examples/graphics/draw_circle-2-animation.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Animate a circle moving across the screen
26 changes: 26 additions & 0 deletions public/usage-examples/graphics/draw_circle-3-interactive.cpp

This comment was marked as resolved.

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include "splashkit.h"

int main()
{
open_window("Interactive Circle", 800, 600);

double x = 400;
double y = 300;

while (!window_close_requested("Interactive Circle"))
{
process_events();
clear_screen(COLOR_WHITE);

if (key_down(LEFT_KEY)) x -= 5;
if (key_down(RIGHT_KEY)) x += 5;
if (key_down(UP_KEY)) y -= 5;
if (key_down(DOWN_KEY)) y += 5;

draw_circle(COLOR_BLUE, x, y, 50);

refresh_screen(60);
}

return 0;
}
23 changes: 23 additions & 0 deletions public/usage-examples/graphics/draw_circle-3-interactive.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from splashkit import *

window = open_window("Interactive Circle", 800, 600)

x = 400
y = 300

while not window_close_requested(window):
process_events()
clear_screen_to_white()

if key_down(left_key()):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Method left_key() does not exist; instead, you should use KeyCode.left_key (a value, not a function). Same goes for the rest of the key identifiers in this file.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for the detailed feedback!

I have fixed all issues:

  • Updated Python API usage (colors, keys, refresh function)
  • Replaced incorrect window loop with quit_requested()
  • Removed unnecessary namespace usage in C++
  • Ensured consistency across all examples

Please let me know if anything else needs improvement.

x -= 5
if key_down(right_key()):
x += 5
if key_down(up_key()):
y -= 5
if key_down(down_key()):
y += 5

draw_circle(color_blue(), x, y, 50)

refresh_screen_with_target_fps(60)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Move a circle using arrow keys to demonstrate interactive usage of draw_circle.