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

namespace BrightnessOfExample
{
public class Program
{
public static void Main()
{
// Open the window for the usage example
SplashKit.OpenWindow("Purple Shade Brightness", 800, 400);

Color[] shades =
{
SplashKit.RGBAColor(70, 30, 100, 255),
SplashKit.RGBAColor(140, 70, 180, 255),
SplashKit.RGBAColor(210, 170, 240, 255)
};

string[] names = { "Dark Purple", "Medium Purple", "Light Purple" };

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

// Draw the background and instructions
SplashKit.ClearScreen(Color.White);
SplashKit.DrawText("Brightness values of purple shades", Color.Black, 210, 40);

// Draw each shade and its brightness value
for (int i = 0; i < 3; i++)
{
double value = SplashKit.BrightnessOf(shades[i]);

SplashKit.FillCircle(shades[i], 150 + i * 240, 180, 55);
SplashKit.DrawText(names[i], Color.Black, 105 + i * 240, 260);
SplashKit.DrawText("Brightness: " + value.ToString(), Color.Black, 75 + i * 240, 300);
}

SplashKit.RefreshScreen(60);
}

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

// Open the window for the usage example
OpenWindow("Purple Shade Brightness", 800, 400);

Color[] shades =
{
RGBAColor(70, 30, 100, 255),
RGBAColor(140, 70, 180, 255),
RGBAColor(210, 170, 240, 255)
};

string[] names = { "Dark Purple", "Medium Purple", "Light Purple" };

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

// Draw the background and instructions
ClearScreen(Color.White);
DrawText("Brightness values of purple shades", Color.Black, 210, 40);

// Draw each shade and its brightness value
for (int i = 0; i < 3; i++)
{
double value = BrightnessOf(shades[i]);

FillCircle(shades[i], 150 + i * 240, 180, 55);
DrawText(names[i], Color.Black, 105 + i * 240, 260);
DrawText("Brightness: " + value.ToString(), Color.Black, 75 + i * 240, 300);
}

RefreshScreen(60);
}

CloseAllWindows();
43 changes: 43 additions & 0 deletions public/usage-examples/color/brightness_of-1-example.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#include "splashkit.h"

int main()
{
// Open the window for the usage example
open_window("Purple Shade Brightness", 800, 400);

color shades[] = {
rgba_color(70, 30, 100, 255),
rgba_color(140, 70, 180, 255),
rgba_color(210, 170, 240, 255)
};

string names[] = {
"Dark Purple",
"Medium Purple",
"Light Purple"
};

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

// Draw the background and instructions
clear_screen(COLOR_WHITE);
draw_text("Brightness values of purple shades", COLOR_BLACK, 210, 40);

// Draw each shade and its brightness value
for (int i = 0; i < 3; i++)
{
double value = brightness_of(shades[i]);

fill_circle(shades[i], 150 + i * 240, 180, 55);
draw_text(names[i], COLOR_BLACK, 105 + i * 240, 260);
draw_text("Brightness: " + std::to_string(value), COLOR_BLACK, 75 + i * 240, 300);
}

refresh_screen(60);
}

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

# Open the window for the usage example
window = open_window("Purple Shade Brightness", 800, 400)

shades = [
rgba_color(70, 30, 100, 255),
rgba_color(140, 70, 180, 255),
rgba_color(210, 170, 240, 255)
]

names = ["Dark Purple", "Medium Purple", "Light Purple"]

while not window_close_requested(window):
process_events()

# Draw the background and instructions
clear_screen(color_white())
draw_text_no_font_no_size("Brightness values of purple shades", color_black(), 210, 40)

# Draw each shade and its brightness value
for i in range(3):
value = brightness_of(shades[i])

fill_circle(shades[i], 150 + i * 240, 180, 55)
draw_text_no_font_no_size(names[i], color_black(), 105 + i * 240, 260)
draw_text_no_font_no_size("Brightness: " + str(value), color_black(), 75 + i * 240, 300)

refresh_screen()

close_window(window)
1 change: 1 addition & 0 deletions public/usage-examples/color/brightness_of-1-example.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Purple Shade Brightness