Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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 (!quit_requested())
{
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 quit_requested():
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 (!quit_requested())
{
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 quit_requested():
process_events()
clear_screen_to_white()

if key_down(KeyCode.left_key):
x -= 5
if key_down(KeyCode.right_key):
x += 5
if key_down(KeyCode.up_key):
y -= 5
if key_down(KeyCode.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.