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
6 changes: 3 additions & 3 deletions coresdk/src/test/test_animation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ void run_animation_test()
{
vector<string> sequence = { "Walkfront", "WalkLeft", "WalkRight", "WALKBACK", "dance" };

cout << "Script should not be loaded: " << has_animation_script("kermit");
cout << "Script should not be loaded: " << has_animation_script("kermit") << endl;

animation_script kermit = load_animation_script("kermit", "kermit.txt");

cout << "Script should be loaded: " << has_animation_script("kermit");
cout << "Script should be loaded: " << has_animation_script("kermit") << endl;

animation anim = create_animation(kermit, "MoonWalkBack");

Expand Down Expand Up @@ -57,7 +57,7 @@ void run_animation_test()
it++;
}

refresh_screen();
refresh_screen(60);

if (quit_requested() ) break;
}
Expand Down
5 changes: 4 additions & 1 deletion coresdk/src/test/test_audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,16 @@ void run_audio_tests()

cout << " Downloading sound effect..." << endl;
download_sound_effect("text message 2", "http://soundbible.com/grab.php?id=2155&type=wav", 80);
cout << " Playing downloaded sound effect..." << endl;
play_sound_effect("text message 2", 2, 0.8);
delay(5000);

cout << " Downloading music..." << endl;
download_music("music", "http://www.royaltyfreemusic.com/music_clips/free/Heartland_1.mp3", 80);
download_music("music", "http://assets.mixkit.co/music/493/493.mp3", 80);
cout << " Playing downloaded music..." << endl;
play_music("music");
delay(5000);
stop_music();

play_sound_effect(s1, 1, 1.0f);

Expand Down
11 changes: 6 additions & 5 deletions coresdk/src/test/test_camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,18 @@ void run_camera_test()
sprite_set_anchor_point(s, bitmap_cell_center(sprite_layer(s, 0)));

bool follow = true;
const int speed = 10;

while ( ! window_close_requested(w1) )
{
process_events();

if ( key_down( LEFT_KEY) ) sprite_set_dx(s, -1);
else if ( key_down( RIGHT_KEY) ) sprite_set_dx(s, 1);
if ( key_down( LEFT_KEY) ) sprite_set_dx(s, -speed);
else if ( key_down( RIGHT_KEY) ) sprite_set_dx(s, speed);
else sprite_set_dx(s, 0);

if ( key_down( UP_KEY) ) sprite_set_dy(s, -1);
else if ( key_down( DOWN_KEY) ) sprite_set_dy(s, 1);
if ( key_down( UP_KEY) ) sprite_set_dy(s, -speed);
else if ( key_down( DOWN_KEY) ) sprite_set_dy(s, speed);
else sprite_set_dy(s, 0);

if ( key_typed(F_KEY) )
Expand Down Expand Up @@ -66,7 +67,7 @@ void run_camera_test()
draw_triangle(COLOR_AQUA, screen_width() / 2, 0, 0, screen_height(), screen_width(), screen_height());

draw_sprite(s);
refresh_screen();
refresh_screen(30);
}

close_window(w1);
Expand Down
12 changes: 7 additions & 5 deletions coresdk/src/test/test_geometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ using namespace std;
#include "window_manager.h"
#include "graphics.h"
#include "input.h"
#include "timers.h"

using namespace splashkit_lib;

Expand Down Expand Up @@ -470,20 +471,21 @@ void test_bitmap_ray_collision()
point_2d bmp_3_center = point_offset_by(bmp_3_position, vector_to(bitmap_center(bmp_3)));
point_2d ray_origin = point_at(100, 100);
vector_2d ray_heading = vector_to(200, 200);
const double RAY_STEP = 5.0;

while ( !window_close_requested(w1) ) {
process_events();

clear_screen(COLOR_WHITE);

if (key_down(UP_KEY))
ray_origin.y -= 1.0;
ray_origin.y -= RAY_STEP;
if (key_down(DOWN_KEY))
ray_origin.y += 1.0;
ray_origin.y += RAY_STEP;
if (key_down(LEFT_KEY))
ray_origin.x -= 1.0;
ray_origin.x -= RAY_STEP;
if (key_down(RIGHT_KEY))
ray_origin.x += 1.0;
ray_origin.x += RAY_STEP;

bool collision_1 = bitmap_ray_collision(bmp_1, 0, bmp_1_position, ray_origin, ray_heading);
bool collision_2 = bitmap_ray_collision(bmp_2, 0, bmp_2_position, ray_origin, ray_heading);
Expand Down Expand Up @@ -517,7 +519,7 @@ void test_bitmap_ray_collision()
circle ray_origin_circle = circle_at(ray_origin, 3.0);
draw_circle(COLOR_BLUE, ray_origin_circle);

refresh_screen();
refresh_screen(30);
}
close_window(w1);
}
Expand Down
11 changes: 6 additions & 5 deletions coresdk/src/test/test_sprites.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -991,20 +991,21 @@ void test_sprite_ray_collision()
sprite_set_rotation(s3, 10.0f);
point_2d ray_origin = point_at(100, 100);
vector_2d ray_heading = vector_to(200, 200);
const double RAY_STEP = 5.0;

while ( !window_close_requested(w1) ) {
process_events();

clear_screen(COLOR_WHITE);

if (key_down(UP_KEY))
ray_origin.y -= 1.0;
ray_origin.y -= RAY_STEP;
if (key_down(DOWN_KEY))
ray_origin.y += 1.0;
ray_origin.y += RAY_STEP;
if (key_down(LEFT_KEY))
ray_origin.x -= 1.0;
ray_origin.x -= RAY_STEP;
if (key_down(RIGHT_KEY))
ray_origin.x += 1.0;
ray_origin.x += RAY_STEP;

bool collision_1 = sprite_ray_collision(s1, ray_origin, ray_heading);
bool collision_2 = sprite_ray_collision(s2, ray_origin, ray_heading);
Expand Down Expand Up @@ -1038,7 +1039,7 @@ void test_sprite_ray_collision()
circle ray_origin_circle = circle_at(ray_origin, 3.0);
draw_circle(COLOR_BLUE, ray_origin_circle);

refresh_screen();
refresh_screen(30);
}
close_window(w1);
}
Expand Down
2 changes: 1 addition & 1 deletion coresdk/src/test/test_tcp_networking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ void run_tcp_networking_test()
pause_test();

cout << "Client still: " << lConA << endl;
cout << "Test message send (to closed client): " << send_message_to(string("A", 876), lConB);
cout << "Test message send (to closed client): " << send_message_to(string("A", 876), lConB) << endl;

pause_test();
cout << "Test message send (expect false): " << send_message_to(string("A", 876), lConB) << endl;
Expand Down
2 changes: 1 addition & 1 deletion coresdk/src/test/test_text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void run_text_test()
load_font("kochi", "kochi-gothic-subst.ttf");
draw_text("スプラッシュ・キット", COLOR_BLACK, "kochi", 30, 0, 280);

download_font("brawler", "https://github.com/google/fonts/raw/master/ofl/brawler/Brawler-Regular.ttf", 443);
download_font("brawler", "https://raw.githubusercontent.com/google/fonts/main/ofl/brawler/Brawler-Regular.ttf", 443);
draw_text("Hello World: Brawler!", COLOR_BLACK, "brawler", 30, 0, 350);

refresh_screen();
Expand Down
3 changes: 1 addition & 2 deletions coresdk/src/test/test_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ using namespace splashkit_lib;
void run_ui_test()
{
open_window("Test UI", 600, 600);

font fontA = load_font("interface font 1", "arial.ttf");
font fontA = load_font("interface font 1", "hara.ttf");
font fontB = load_font("interface font 2", "kochi-gothic-subst.ttf");
set_interface_font(fontA);
set_interface_font_size(12);
Expand Down