Skip to content

Commit

Permalink
Add extended draw_bitmap_named usage example with audio to demonstrat…
Browse files Browse the repository at this point in the history
…e updated script
  • Loading branch information
omckeon committed Dec 6, 2024
1 parent 44c5d5b commit 461bcd4
Show file tree
Hide file tree
Showing 6 changed files with 401 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
using SplashKitSDK;

namespace GUIHelloWorld
{
public class Program
{
public static void Main()
{
// Download resources
SplashKit.DownloadSoundEffect("Hello World", "https://programmers.guide/resources/code-examples/part-0/hello-world-snippet-saddle-club.ogg", 443);
SplashKit.DownloadFont("main", "https://programmers.guide/resources/code-examples/part-0/Roboto-Italic.ttf", 443);
SplashKit.DownloadBitmap("Earth", "https://programmers.guide/resources/code-examples/part-0/earth.png", 443);
SplashKit.DownloadBitmap("SmallEarth", "https://programmers.guide/resources/code-examples/part-0/earth-small.png", 443);
SplashKit.DownloadBitmap("SplashKitBox", "https://programmers.guide/resources/code-examples/part-0/skbox.png", 443);

SplashKit.OpenWindow("Hello World: Using Resources with SplashKit", 800, 600);
SplashKit.PlaySoundEffect("Hello World");

SplashKit.ClearScreen(Color.White);
SplashKit.DrawText("Anyone remember the \"Hello World\" Saddle Club song?", Color.Black, "main", 30, 40, 200);
SplashKit.RefreshScreen();
SplashKit.Delay(2500);

SplashKit.ClearScreen(Color.White);

// H
SplashKit.DrawBitmap("SmallEarth", 20, 100);
SplashKit.DrawBitmap("SmallEarth", 20, 130);
SplashKit.DrawBitmap("SmallEarth", 20, 160);
SplashKit.DrawBitmap("SmallEarth", 20, 190);
SplashKit.DrawBitmap("SmallEarth", 20, 220);
SplashKit.DrawBitmap("SmallEarth", 52, 160);
SplashKit.DrawBitmap("SmallEarth", 84, 100);
SplashKit.DrawBitmap("SmallEarth", 84, 130);
SplashKit.DrawBitmap("SmallEarth", 84, 160);
SplashKit.DrawBitmap("SmallEarth", 84, 190);
SplashKit.DrawBitmap("SmallEarth", 84, 220);
SplashKit.RefreshScreen();
SplashKit.Delay(200);

// E
SplashKit.DrawBitmap("SmallEarth", 148, 100);
SplashKit.DrawBitmap("SmallEarth", 148, 130);
SplashKit.DrawBitmap("SmallEarth", 148, 160);
SplashKit.DrawBitmap("SmallEarth", 148, 190);
SplashKit.DrawBitmap("SmallEarth", 148, 220);
SplashKit.DrawBitmap("SmallEarth", 180, 100);
SplashKit.DrawBitmap("SmallEarth", 212, 100);
SplashKit.DrawBitmap("SmallEarth", 180, 160);
SplashKit.DrawBitmap("SmallEarth", 180, 220);
SplashKit.DrawBitmap("SmallEarth", 212, 220);
SplashKit.RefreshScreen();
SplashKit.Delay(200);

// L
SplashKit.DrawBitmap("SmallEarth", 276, 100);
SplashKit.DrawBitmap("SmallEarth", 276, 130);
SplashKit.DrawBitmap("SmallEarth", 276, 160);
SplashKit.DrawBitmap("SmallEarth", 276, 190);
SplashKit.DrawBitmap("SmallEarth", 276, 220);
SplashKit.DrawBitmap("SmallEarth", 308, 220);
SplashKit.DrawBitmap("SmallEarth", 340, 220);
SplashKit.RefreshScreen();
SplashKit.Delay(200);

// L
SplashKit.DrawBitmap("SmallEarth", 404, 100);
SplashKit.DrawBitmap("SmallEarth", 404, 130);
SplashKit.DrawBitmap("SmallEarth", 404, 160);
SplashKit.DrawBitmap("SmallEarth", 404, 190);
SplashKit.DrawBitmap("SmallEarth", 404, 220);
SplashKit.DrawBitmap("SmallEarth", 436, 220);
SplashKit.DrawBitmap("SmallEarth", 468, 220);
SplashKit.RefreshScreen();
SplashKit.Delay(200);

// O
SplashKit.DrawBitmap("SmallEarth", 530, 160);
SplashKit.DrawBitmap("SmallEarth", 622, 160);
SplashKit.DrawBitmap("SmallEarth", 540, 128);
SplashKit.DrawBitmap("SmallEarth", 560, 100);
SplashKit.DrawBitmap("SmallEarth", 592, 100);
SplashKit.DrawBitmap("SmallEarth", 612, 128);
SplashKit.DrawBitmap("SmallEarth", 540, 192);
SplashKit.DrawBitmap("SmallEarth", 560, 220);
SplashKit.DrawBitmap("SmallEarth", 592, 220);
SplashKit.DrawBitmap("SmallEarth", 612, 192);
SplashKit.RefreshScreen();
SplashKit.Delay(500);

// World
SplashKit.DrawBitmap("Earth", 100, 350);
SplashKit.RefreshScreen();
SplashKit.Delay(2000);

// SplashKit ("Me")
SplashKit.DrawBitmap("SplashKitBox", 450, 300);
SplashKit.DrawText("SplashKit!", Color.Black, "main", 50, 450, 530);
SplashKit.RefreshScreen();
SplashKit.Delay(2000);

SplashKit.CloseAllWindows();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
using static SplashKitSDK.SplashKit;

// Download resources
DownloadSoundEffect("Hello World", "https://programmers.guide/resources/code-examples/part-0/hello-world-snippet-saddle-club.ogg", 443);
DownloadFont("main", "https://programmers.guide/resources/code-examples/part-0/Roboto-Italic.ttf", 443);
DownloadBitmap("Earth", "https://programmers.guide/resources/code-examples/part-0/earth.png", 443);
DownloadBitmap("SmallEarth", "https://programmers.guide/resources/code-examples/part-0/earth-small.png", 443);
DownloadBitmap("SplashKitBox", "https://programmers.guide/resources/code-examples/part-0/skbox.png", 443);

OpenWindow("Hello World: Using Resources with SplashKit", 800, 600);
PlaySoundEffect("Hello World");

ClearScreen(ColorWhite());
DrawText("Anyone remember the \"Hello World\" Saddle Club song?", ColorBlack(), "main", 30, 40, 200);
RefreshScreen();
Delay(2500);

ClearScreen(ColorWhite());

// H
DrawBitmap("SmallEarth", 20, 100);
DrawBitmap("SmallEarth", 20, 130);
DrawBitmap("SmallEarth", 20, 160);
DrawBitmap("SmallEarth", 20, 190);
DrawBitmap("SmallEarth", 20, 220);
DrawBitmap("SmallEarth", 52, 160);
DrawBitmap("SmallEarth", 84, 100);
DrawBitmap("SmallEarth", 84, 130);
DrawBitmap("SmallEarth", 84, 160);
DrawBitmap("SmallEarth", 84, 190);
DrawBitmap("SmallEarth", 84, 220);
RefreshScreen();
Delay(200);

// E
DrawBitmap("SmallEarth", 148, 100);
DrawBitmap("SmallEarth", 148, 130);
DrawBitmap("SmallEarth", 148, 160);
DrawBitmap("SmallEarth", 148, 190);
DrawBitmap("SmallEarth", 148, 220);
DrawBitmap("SmallEarth", 180, 100);
DrawBitmap("SmallEarth", 212, 100);
DrawBitmap("SmallEarth", 180, 160);
DrawBitmap("SmallEarth", 180, 220);
DrawBitmap("SmallEarth", 212, 220);
RefreshScreen();
Delay(200);

// L
DrawBitmap("SmallEarth", 276, 100);
DrawBitmap("SmallEarth", 276, 130);
DrawBitmap("SmallEarth", 276, 160);
DrawBitmap("SmallEarth", 276, 190);
DrawBitmap("SmallEarth", 276, 220);
DrawBitmap("SmallEarth", 308, 220);
DrawBitmap("SmallEarth", 340, 220);
RefreshScreen();
Delay(200);

// L
DrawBitmap("SmallEarth", 404, 100);
DrawBitmap("SmallEarth", 404, 130);
DrawBitmap("SmallEarth", 404, 160);
DrawBitmap("SmallEarth", 404, 190);
DrawBitmap("SmallEarth", 404, 220);
DrawBitmap("SmallEarth", 436, 220);
DrawBitmap("SmallEarth", 468, 220);
RefreshScreen();
Delay(200);

// O
DrawBitmap("SmallEarth", 530, 160);
DrawBitmap("SmallEarth", 622, 160);
DrawBitmap("SmallEarth", 540, 128);
DrawBitmap("SmallEarth", 560, 100);
DrawBitmap("SmallEarth", 592, 100);
DrawBitmap("SmallEarth", 612, 128);
DrawBitmap("SmallEarth", 540, 192);
DrawBitmap("SmallEarth", 560, 220);
DrawBitmap("SmallEarth", 592, 220);
DrawBitmap("SmallEarth", 612, 192);
RefreshScreen();
Delay(500);

// World
DrawBitmap("Earth", 100, 350);
RefreshScreen();
Delay(2000);

// SplashKit ("Me")
DrawBitmap("SplashKitBox", 450, 300);
DrawText("SplashKit!", ColorBlack(), "main", 50, 450, 530);
RefreshScreen();
Delay(2000);
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
#include "splashkit.h"

int main()
{
// Download resources
download_sound_effect("Hello World", "https://programmers.guide/resources/code-examples/part-0/hello-world-snippet-saddle-club.ogg", 443);
download_font("main", "https://programmers.guide/resources/code-examples/part-0/Roboto-Italic.ttf", 443);
download_bitmap("Earth", "https://programmers.guide/resources/code-examples/part-0/earth.png", 443);
download_bitmap("SmallEarth", "https://programmers.guide/resources/code-examples/part-0/earth-small.png", 443);
download_bitmap("SplashKitBox", "https://programmers.guide/resources/code-examples/part-0/skbox.png", 443);

open_window("Hello World: Using Resources with SplashKit", 800, 600);
play_sound_effect("Hello World");

clear_screen(COLOR_WHITE);
draw_text("Anyone remember the \"Hello World\" Saddle Club song?", COLOR_BLACK, "main", 30, 40, 200);
refresh_screen();
delay(2500);

clear_screen(COLOR_WHITE);

// H
draw_bitmap("SmallEarth", 20, 100);
draw_bitmap("SmallEarth", 20, 130);
draw_bitmap("SmallEarth", 20, 160);
draw_bitmap("SmallEarth", 20, 190);
draw_bitmap("SmallEarth", 20, 220);
draw_bitmap("SmallEarth", 52, 160);
draw_bitmap("SmallEarth", 84, 100);
draw_bitmap("SmallEarth", 84, 130);
draw_bitmap("SmallEarth", 84, 160);
draw_bitmap("SmallEarth", 84, 190);
draw_bitmap("SmallEarth", 84, 220);
refresh_screen();
delay(200);

// E
draw_bitmap("SmallEarth", 148, 100);
draw_bitmap("SmallEarth", 148, 130);
draw_bitmap("SmallEarth", 148, 160);
draw_bitmap("SmallEarth", 148, 190);
draw_bitmap("SmallEarth", 148, 220);
draw_bitmap("SmallEarth", 180, 100);
draw_bitmap("SmallEarth", 212, 100);
draw_bitmap("SmallEarth", 180, 160);
draw_bitmap("SmallEarth", 180, 220);
draw_bitmap("SmallEarth", 212, 220);
refresh_screen();
delay(200);

// L
draw_bitmap("SmallEarth", 276, 100);
draw_bitmap("SmallEarth", 276, 130);
draw_bitmap("SmallEarth", 276, 160);
draw_bitmap("SmallEarth", 276, 190);
draw_bitmap("SmallEarth", 276, 220);
draw_bitmap("SmallEarth", 308, 220);
draw_bitmap("SmallEarth", 340, 220);
refresh_screen();
delay(200);

// L
draw_bitmap("SmallEarth", 404, 100);
draw_bitmap("SmallEarth", 404, 130);
draw_bitmap("SmallEarth", 404, 160);
draw_bitmap("SmallEarth", 404, 190);
draw_bitmap("SmallEarth", 404, 220);
draw_bitmap("SmallEarth", 436, 220);
draw_bitmap("SmallEarth", 468, 220);
refresh_screen();
delay(200);

// O
draw_bitmap("SmallEarth", 530, 160);
draw_bitmap("SmallEarth", 622, 160);
draw_bitmap("SmallEarth", 540, 128);
draw_bitmap("SmallEarth", 560, 100);
draw_bitmap("SmallEarth", 592, 100);
draw_bitmap("SmallEarth", 612, 128);
draw_bitmap("SmallEarth", 540, 192);
draw_bitmap("SmallEarth", 560, 220);
draw_bitmap("SmallEarth", 592, 220);
draw_bitmap("SmallEarth", 612, 192);
refresh_screen();
delay(500);

// World
draw_bitmap("Earth", 100, 350);
refresh_screen();
delay(2000);

// SplashKit ("Me")
draw_bitmap("SplashKitBox", 450, 300);
draw_text("SplashKit!", COLOR_BLACK, "main", 50, 450, 530);
refresh_screen();
delay(2000);

close_all_windows();

return 0;
}
Loading

0 comments on commit 461bcd4

Please sign in to comment.