Skip to content
Open
Show file tree
Hide file tree
Changes from all 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.
25 changes: 10 additions & 15 deletions public/usage-examples/graphics/draw_line-1-example-oop.cs
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
using SplashKitSDK;
using static SplashKitSDK.SplashKit;

namespace DrawLineExample
{
public class Program
{
public static void Main()
{
Window window = new Window("Colourful Starburst", 600, 600);
window.Clear(Color.Black);
OpenWindow("Draw Line Example", 800, 600);

// Draws starburst pattern with changing colours to window
window.DrawLine(Color.Yellow, 0, 0, 600, 600);
window.DrawLine(Color.Green, 0, 150, 600, 450);
window.DrawLine(Color.Teal, 0, 300, 600, 300);
window.DrawLine(Color.Blue, 0, 450, 600, 150);
window.DrawLine(Color.Violet, 0, 600, 600, 0);
window.DrawLine(Color.Purple, 150, 0, 450, 600);
window.DrawLine(Color.Pink, 300, 0, 300, 600);
window.DrawLine(Color.Red, 450, 0, 150, 600);
window.DrawLine(Color.Orange, 600, 0, 0, 600);
while (!QuitRequested())
{
ProcessEvents();
ClearScreen(ColorWhite());

window.Refresh();
SplashKit.Delay(5000);
window.Close();
DrawLine(ColorRed(), 100, 100, 700, 500);

RefreshScreen(60);
}
}
}
}
24 changes: 9 additions & 15 deletions public/usage-examples/graphics/draw_line-1-example-top-level.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
using static SplashKitSDK.SplashKit;

OpenWindow("Colourful Starburst", 600, 600);
ClearScreen(ColorBlack());
OpenWindow("Draw Line Example", 800, 600);

// Draws starburst pattern with changing colours
DrawLine(ColorYellow(), 0, 0, 600, 600);
DrawLine(ColorGreen(), 0, 150, 600, 450);
DrawLine(ColorTeal(), 0, 300, 600, 300);
DrawLine(ColorBlue(), 0, 450, 600, 150);
DrawLine(ColorViolet(), 0, 600, 600, 0);
DrawLine(ColorPurple(), 150, 0, 450, 600);
DrawLine(ColorPink(), 300, 0, 300, 600);
DrawLine(ColorRed(), 450, 0, 150, 600);
DrawLine(ColorOrange(), 600, 0, 0, 600);
while (!QuitRequested())
{
ProcessEvents();
ClearScreen(ColorWhite());

RefreshScreen();
Delay(5000);
CloseAllWindows();
DrawLine(ColorRed(), 100, 100, 700, 500);

RefreshScreen(60);
}
27 changes: 11 additions & 16 deletions public/usage-examples/graphics/draw_line-1-example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,17 @@

int main()
{
open_window("Colourful Starburst", 600, 600);
clear_screen(COLOR_BLACK);
open_window("Draw Line Example", 800, 600);

// Draws starburst pattern with changing colours to window
draw_line(COLOR_YELLOW, 0, 0, 600, 600);
draw_line(COLOR_GREEN, 0, 150, 600, 450);
draw_line(COLOR_TEAL, 0, 300, 600, 300);
draw_line(COLOR_BLUE, 0, 450, 600, 150);
draw_line(COLOR_VIOLET, 0, 600, 600, 0);
draw_line(COLOR_PURPLE, 150, 0, 450, 600);
draw_line(COLOR_PINK, 300, 0, 300, 600);
draw_line(COLOR_RED, 450, 0, 150, 600);
draw_line(COLOR_ORANGE, 600, 0, 0, 600);
while (!quit_requested())
{
process_events();
clear_screen(COLOR_WHITE);

draw_line(COLOR_RED, 100, 100, 700, 500);

refresh_screen(60);
}

refresh_screen();
delay(5000);
close_all_windows();
return 0;
}
}
22 changes: 7 additions & 15 deletions public/usage-examples/graphics/draw_line-1-example.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
from splashkit import *

open_window("Colourful Starburst", 600, 600)
clear_screen(color_black())
open_window("Draw Line Example", 800, 600)

# Draws starburst pattern with changing colours to window
draw_line(color_yellow(), 0, 0, 600, 600)
draw_line(color_green(), 0, 150, 600, 450)
draw_line(color_teal(), 0, 300, 600, 300)
draw_line(color_blue(), 0, 450, 600, 150)
draw_line(color_violet(), 0, 600, 600, 0)
draw_line(color_purple(), 150, 0, 450, 600)
draw_line(color_pink(), 300, 0, 300, 600)
draw_line(color_red(), 450, 0, 150, 600)
draw_line(color_orange(), 600, 0, 0, 600)
while not quit_requested():
process_events()
clear_screen_to_white()

refresh_screen()
delay(5000)
close_all_windows()
draw_line(color_red(), 100, 100, 700, 500)

refresh_screen_with_target_fps(60)
2 changes: 1 addition & 1 deletion public/usage-examples/graphics/draw_line-1-example.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Colourful Starburst
Draw a red line across the screen