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
40 changes: 40 additions & 0 deletions public/usage-examples/color/random_color-2-example-oop.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using SplashKitSDK;

public static class Program
{
public static void Main()
{
new Window("Random Color Example", 800, 600);

Color boxColor = Color.Blue;

while (!SplashKit.QuitRequested())
{
SplashKit.ProcessEvents();

if (SplashKit.MouseClicked(MouseButton.LeftButton))
{
boxColor = SplashKit.RandomColor();
}

SplashKit.ClearScreen(Color.White);

SplashKit.FillRectangle(
boxColor,
250,
200,
300,
180
);

SplashKit.DrawText(
"Click anywhere to change colour",
Color.Black,
220,
420
);

SplashKit.RefreshScreen();
}
}
}
34 changes: 34 additions & 0 deletions public/usage-examples/color/random_color-2-example-top-level.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using SplashKitSDK;

new Window("Random Color Example", 800, 600);

Color boxColor = Color.Blue;

while (!SplashKit.QuitRequested())
{
SplashKit.ProcessEvents();

if (SplashKit.MouseClicked(MouseButton.LeftButton))
{
boxColor = SplashKit.RandomColor();
}

SplashKit.ClearScreen(Color.White);

SplashKit.FillRectangle(
boxColor,
250,
200,
300,
180
);

SplashKit.DrawText(
"Click anywhere to change colour",
Color.Black,
220,
420
);

SplashKit.RefreshScreen();
}
33 changes: 33 additions & 0 deletions public/usage-examples/color/random_color-2-example.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include "splashkit.h"

int main()
{
open_window("Random Color Example", 800, 600);

color box_color = COLOR_BLUE;

while (!quit_requested())
{
process_events();

if (mouse_clicked(LEFT_BUTTON))
{
box_color = random_color();
}

clear_screen(COLOR_WHITE);

fill_rectangle(box_color, 250, 200, 300, 180);

draw_text(
"Click anywhere to change colour",
COLOR_BLACK,
220,
420
);

refresh_screen();
}

return 0;
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions public/usage-examples/color/random_color-2-example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from splashkit import *

open_window("Random Color Example", 800, 600)

box_color = color_blue()

while not quit_requested():
process_events()

if mouse_clicked(LEFT_BUTTON):
box_color = random_color()

clear_screen(color_white())

fill_rectangle(box_color, 250, 200, 300, 180)

draw_text(
"Click anywhere to change colour",
color_black(),
220,
420
)

refresh_screen()
3 changes: 3 additions & 0 deletions public/usage-examples/color/random_color-2-example.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Interactive random colour example

Click the rectangle to change it to a random colour using random_color().