Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
JujuAdams committed Mar 8, 2020
2 parents b0875e4 + 267697d commit ff388a4
Show file tree
Hide file tree
Showing 40 changed files with 901 additions and 378 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<h1 align="center">Scribble 5.3.3</h1>
<h1 align="center">Scribble 5.4.3</h1>

<p align="center"><a href="https://github.com/JujuAdams/scribble/releases/tag/5.3.3b">Download .yymp here</a></p>
<p align="center"><a href="https://github.com/JujuAdams/scribble/releases/tag/5.4.3">Download .yymp here</a></p>

### @jujuadams

Vertex buffer-based text engine. Faster and more comprehensive than GameMaker's native rendering. Shader-based processing allows for efficient and flexible dynamic effects without lots of expensive CPU-side draw_text() calls.

[Find out what's changed](https://github.com/JujuAdams/scribble/blob/dev/changes.md) since version 4.x.x. [A "lite" version is also available](https://github.com/JujuAdams/scribble/tree/lite).
[Find out what's changed](https://github.com/JujuAdams/scribble/blob/dev/changes.md) since version 4.x.x.

With thanks to glitchroy, Mark Turner, DragoniteSpam, sp202, Rob van Saaze, soVes, and @stoozey_ for testing.

Expand All @@ -20,7 +20,7 @@ GameMaker Studio 2.2.3 allows you to import assets, including scripts and shader

**How do I set up Scribble?**

Scribble is made from 15 mandatory scripts and a shader. There are 10 optional scripts that unlock more advanced functionality, though they're not needed for basic use. The ["Lite" version](https://github.com/JujuAdams/scribble/tree/lite)() skips out the optional scripts which handle automatic typewriter effects, events, and various nuts-and-bolts options that are useful but not essential.
Scribble is made from 15 mandatory scripts and a shader. There are 17 extra scripts that unlock more advanced functionality, though they're not needed for basic use. The ["Lite" version](https://github.com/JujuAdams/scribble/tree/lite)() skips out the optional scripts which handle automatic typewriter effects, events, and various nuts-and-bolts options that are useful but not essential.

Scribble requires that you explicitly initialise fonts for use with Scribble. This is a three-step process:

Expand Down
63 changes: 62 additions & 1 deletion Scribble.yyp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions objects/obj_example_autotype/Create_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ var _mapstring = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
scribble_add_spritefont("spr_sprite_font", _mapstring, 0, 3);

//Add some colour definitions that we'll use in the demo string
scribble_add_colour("c_coquelicot", $ff3800);
scribble_add_colour("c_smaragdine", $50c875);
scribble_add_colour("c_xanadu" , $738678);
scribble_add_colour("c_amaranth" , $e52b50);
scribble_add_color("c_coquelicot", $ff3800);
scribble_add_color("c_smaragdine", $50c875);
scribble_add_color("c_xanadu" , $738678);
scribble_add_color("c_amaranth" , $e52b50);

scribble_autotype_add_event("test event", example_event);

Expand All @@ -19,7 +19,7 @@ scribble_autotype_add_event("test event", example_event);
var _demo_string = "[rainbow][pulse]abcdef[] ABCDEF[test event]##";
_demo_string += "[wave][c_orange]0123456789[] .,<>\"'&[c_white][spr_coin,0][spr_coin,1][spr_coin,2][spr_coin,3][shake][rainbow]!?[]\n";
_demo_string += "[fa_centre][spr_coin][spr_coin][spr_coin][spr_large_coin][test event]\n";
_demo_string += "[spr_sprite_font]the quick brown fox [wave]jumps[/wave] over the lazy dog";
_demo_string += "[fa_left][spr_sprite_font]the quick brown fox [wave]jumps[/wave] over the lazy dog";
_demo_string += "[fnt_test_0][fa_right]THE [fnt_test_1][#ff4499][shake]QUICK[fnt_test_0] [$D2691E]BROWN [$FF4499]FOX [fa_left]JUMPS OVER[$FFFF00] THE [/shake]LAZY [fnt_test_1][wobble]DOG[/wobble].";

element = scribble_draw(x - 150, y - 80, _demo_string);
Expand Down
17 changes: 9 additions & 8 deletions objects/obj_example_autotype__/Create_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@ scribble_init("Fonts", "fnt_test_0", true);
var _mapstring = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789,.-;:_+-*/\\'\"!?~^°<>|(){[]}%&=#@$ÄÖÜäöüß";
scribble_add_spritefont("spr_sprite_font", _mapstring, 0, 3);

scribble_add_colour("c_coquelicot", $ff3800);
scribble_add_colour("c_smaragdine", $50c875);
scribble_add_colour("c_xanadu" , $738678);
scribble_add_colour("c_amaranth" , $e52b50);
scribble_add_color("c_coquelicot", $ff3800);
scribble_add_color("c_smaragdine", $50c875);
scribble_add_color("c_xanadu" , $738678);
scribble_add_color("c_amaranth" , $e52b50);

scribble_autotype_add_event("test event", example_event);



var _demo_string = "[rainbow][pulse]abcdef[] ABCDEF[test event]##";
_demo_string += "[wave][c_orange]0123456789[] .,<>\"'&[c_white][spr_coin,0][spr_coin,1][spr_coin,2][spr_coin,3][shake][rainbow]!?[]\n";
_demo_string += "[fa_centre][spr_coin][spr_coin][spr_coin][spr_coin]\n";
_demo_string += "[spr_sprite_font]the quick brown fox [wave]jumps[/wave] over the lazy dog";
_demo_string += "[fnt_test_0][fa_right]THE [fnt_test_1][#ff4499][shake]QUICK[fnt_test_0] [$D2691E]BROWN [$FF4499]FOX [fa_left]JUMPS OVER[$FFFF00] THE [/shake]LAZY [fnt_test_1][wobble]DOG[/wobble].[test event][test event] [test event]";
_demo_string += "[fa_centre][spr_coin][spr_coin][spr_coin][spr_large_coin][test event]\n";
_demo_string += "[fa_left][spr_sprite_font]the quick brown fox [wave]jumps[/wave] over the lazy dog";
_demo_string += "[fnt_test_0][fa_right]THE [fnt_test_1][#ff4499][shake]QUICK[fnt_test_0] [$D2691E]BROWN [$FF4499]FOX [fa_left]JUMPS OVER[$FFFF00] THE [/shake]LAZY [fnt_test_1][wobble]DOG[/wobble].";

element = scribble_draw(x - 150, y - 80, _demo_string);
scribble_autotype_fade_in(element, SCRIBBLE_AUTOTYPE_PER_CHARACTER, 0.5, 0);
scribble_autotype_fade_in(element, SCRIBBLE_AUTOTYPE_PER_CHARACTER, 0.5, 0);
scribble_autotype_set_sound(element, [snd_vowel_0, snd_vowel_1, snd_vowel_2, snd_vowel_3, snd_vowel_4], 30);
2 changes: 1 addition & 1 deletion objects/obj_example_basic/Draw_0.gml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var _demo_string = "[rainbow][pulse]abcdef[] ABCDEF##";
_demo_string += "[wave][c_orange]0123456789[] .,<>\"'&[c_white][spr_coin,0][spr_coin,1][spr_coin,2][spr_coin,3][shake][rainbow]!?[]\n";
_demo_string += "[fa_centre][spr_coin][spr_coin][spr_coin][spr_large_coin][fa_left]\n";
_demo_string += "[spr_sprite_font]the quick brown fox [wave]jumps[/wave] over the lazy dog";
_demo_string += "[fa_left][spr_sprite_font]the quick brown fox [wave]jumps[/wave] over the lazy dog";
_demo_string += "[fnt_test_0][fa_right]THE [fnt_test_1][#ff4499][shake]QUICK[fnt_test_0] [$D2691E]BROWN [$FF4499]FOX [fa_left]JUMPS OVER[$FFFF00] THE [/shake]LAZY [fnt_test_1][wobble]DOG[/wobble].";

//Draw the string
Expand Down
4 changes: 2 additions & 2 deletions objects/obj_example_basic__/Draw_0.gml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var _demo_string = "[rainbow][pulse]abcdef[] ABCDEF##";
_demo_string += "[wave][c_orange]0123456789[] .,<>\"'&[c_white][spr_coin,0][spr_coin,1][spr_coin,2][spr_coin,3][shake][rainbow]!?[]\n";
_demo_string += "[fa_centre][spr_coin][spr_coin][spr_coin][spr_coin]\n";
_demo_string += "[spr_sprite_font]the quick brown fox [wave]jumps[/wave] over the lazy dog";
_demo_string += "[fa_centre][spr_coin][spr_coin][spr_coin][spr_large_coin][fa_left]\n";
_demo_string += "[fa_left][spr_sprite_font]the quick brown fox [wave]jumps[/wave] over the lazy dog";
_demo_string += "[fnt_test_0][fa_right]THE [fnt_test_1][#ff4499][shake]QUICK[fnt_test_0] [$D2691E]BROWN [$FF4499]FOX [fa_left]JUMPS OVER[$FFFF00] THE [/shake]LAZY [fnt_test_1][wobble]DOG[/wobble].";

scribble_draw(x - 150, y - 80, _demo_string);
12 changes: 6 additions & 6 deletions objects/obj_example_precache/Create_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ var _mapstring = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
scribble_add_spritefont("spr_sprite_font", _mapstring, 0, 3);

//Add some colour definitions
scribble_add_colour("c_coquelicot", $ff3800);
scribble_add_colour("c_smaragdine", $50c875);
scribble_add_colour("c_xanadu" , $738678);
scribble_add_colour("c_amaranth" , $e52b50);
scribble_add_color("c_coquelicot", $ff3800);
scribble_add_color("c_smaragdine", $50c875);
scribble_add_color("c_xanadu" , $738678);
scribble_add_color("c_amaranth" , $e52b50);

//Some characters need a bit of fine adjustment in code since it's not always possible to fix this in the font itself
scribble_set_glyph_property("spr_sprite_font", "f", SCRIBBLE_GLYPH.SEPARATION, -1, true);
Expand All @@ -21,8 +21,8 @@ scribble_autotype_add_event("sound", example_event_sound);

var _demo_string = "[sound,snd_crank][rainbow][pulse]abcdef[] ABCDEF##";
_demo_string += "[wave][c_orange]0123456789[] .,<>\"'&[c_white][spr_coin,0][sound,snd_switch][spr_coin,1][sound,snd_switch][spr_coin,2][sound,snd_switch][spr_coin,3][sound,snd_switch][][shake][rainbow]!?[]\n";
_demo_string += "[spr_coin][spr_coin,1,0.1][spr_coin,2,0.1][spr_large_coin,3,0.1]\n";
_demo_string += "[spr_sprite_font]the quick brown fox [wave]jumps[/wave] over the lazy dog";
_demo_string += "[fa_center][spr_coin][spr_coin,1,0.1][spr_coin,2,0.1][spr_large_coin,3,0.1][]\n";
_demo_string += "[fa_left][spr_sprite_font]the quick brown fox [wave]jumps[/wave] over the lazy dog";
_demo_string += "[fnt_test_0][fa_right]THE [fnt_test_1][#ff4499][shake]QUICK[fnt_test_0] [$D2691E]BROWN [$FF4499]FOX [fa_left]JUMPS OVER[$FFFF00] THE [/shake]LAZY [fnt_test_1][wobble]DOG[/wobble].";

//Now parse the string to make some Scribble data
Expand Down
23 changes: 12 additions & 11 deletions objects/obj_example_precache__/Create_0.gml
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
//Setup
scribble_init("Fonts", "fnt_test_0", true);

var _mapstring = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789,.-;:_+-*/\\'\"!?~^°<>|(){[]}%&=#@$ÄÖÜäöüß";
scribble_add_spritefont("spr_sprite_font", _mapstring, 0, 3);

scribble_add_colour("c_coquelicot", $ff3800);
scribble_add_colour("c_smaragdine", $50c875);
scribble_add_colour("c_xanadu" , $738678);
scribble_add_colour("c_amaranth" , $e52b50);
scribble_add_color("c_coquelicot", $ff3800);
scribble_add_color("c_smaragdine", $50c875);
scribble_add_color("c_xanadu" , $738678);
scribble_add_color("c_amaranth" , $e52b50);

scribble_set_glyph_property("spr_sprite_font", "f", SCRIBBLE_GLYPH.SEPARATION, -1, true);
scribble_set_glyph_property("spr_sprite_font", "q", SCRIBBLE_GLYPH.SEPARATION, -1, true);

scribble_autotype_add_event("sound", example_event_sound);


//Create the text element
var _demo_string = "[rainbow][pulse]abcdef[] ABCDEF##";
_demo_string += "[wave][c_orange]0123456789[] .,<>\"'&[c_white][spr_coin,0][spr_coin,1][spr_coin,2][spr_coin,3][][shake][rainbow]!?[]\n";
_demo_string += "[spr_coin][spr_coin,1,0.1][spr_coin,2,0.1][spr_large_coin,3,0.1]\n";
_demo_string += "[spr_sprite_font]the quick brown fox [wave]jumps[/wave] over the lazy dog";

var _demo_string = "[sound,snd_crank][rainbow][pulse]abcdef[] ABCDEF##";
_demo_string += "[wave][c_orange]0123456789[] .,<>\"'&[c_white][spr_coin,0][sound,snd_switch][spr_coin,1][sound,snd_switch][spr_coin,2][sound,snd_switch][spr_coin,3][sound,snd_switch][][shake][rainbow]!?[]\n";
_demo_string += "[fa_center][spr_coin][spr_coin,1,0.1][spr_coin,2,0.1][spr_large_coin,3,0.1][]\n";
_demo_string += "[fa_left][spr_sprite_font]the quick brown fox [wave]jumps[/wave] over the lazy dog";
_demo_string += "[fnt_test_0][fa_right]THE [fnt_test_1][#ff4499][shake]QUICK[fnt_test_0] [$D2691E]BROWN [$FF4499]FOX [fa_left]JUMPS OVER[$FFFF00] THE [/shake]LAZY [fnt_test_1][wobble]DOG[/wobble].";

scribble_draw_set_cache_group("example cache group", false, false);
scribble = scribble_draw(0, 0, _demo_string);
element = scribble_draw(0, 0, _demo_string);

scribble_draw_reset();
9 changes: 5 additions & 4 deletions objects/obj_example_precache__/Draw_0.gml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
scribble_draw_set_box_align(fa_center, fa_middle);
scribble_draw(x, y, scribble);
var _bbox = scribble_get_bbox(scribble, x, y, 5, 5, 5, 5);
scribble_draw_reset();
scribble_draw(x, y, element);

var _bbox = scribble_get_bbox(element, x, y, 5, 5, 5, 5);
draw_rectangle(_bbox[SCRIBBLE_BBOX.L], _bbox[SCRIBBLE_BBOX.T],
_bbox[SCRIBBLE_BBOX.R], _bbox[SCRIBBLE_BBOX.B], true);
_bbox[SCRIBBLE_BBOX.R], _bbox[SCRIBBLE_BBOX.B], true);

scribble_draw_reset();
31 changes: 17 additions & 14 deletions objects/obj_test/Create_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ scribble_init("Fonts", "fnt_test_0", true);
var _mapstring = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789,.-;:_+-*/\\'\"!?~^°<>|(){[]}%&=#@$ÄÖÜäöüß";
scribble_add_spritefont("spr_sprite_font", _mapstring, 0, 11);

scribble_add_colour("c_coquelicot", $ff3800);
scribble_add_colour("c_smaragdine", $50c875);
scribble_add_colour("c_xanadu" , $738678);
scribble_add_colour("c_amaranth" , $e52b50);
scribble_add_color("c_coquelicot", $ff3800);
scribble_add_color("c_smaragdine", $50c875);
scribble_add_color("c_xanadu" , $738678);
scribble_add_color("c_amaranth" , $e52b50);

scribble_autotype_add_event("pause", example_pause);

Expand All @@ -17,21 +17,24 @@ var _mapstring = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
test_string = "The Quick Brown Fox Jumps Over The Lazy Dog!";
spritefont = font_add_sprite_ext(spr_sprite_font, _mapstring, true, 0);

demo_string = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabcaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
demo_string += "[rainbow][pulse]TEST[] [slant]AaBbCcDdEeFf[/slant]##";
demo_string += "a b c d e f g h i j k l m n o p q r s t u v w x y z\n\n";
demo_string += "[wave][c_orange]0123456789[] .,<>\"'&[c_white][spr_coin,0][spr_coin,1][spr_coin,2][spr_coin,3][][shake][rainbow]!?[]\n";
demo_string += "[spr_coin][spr_coin,1,0.1][spr_coin,2,0.1][spr_large_coin,3,0.1] \n";
demo_string += "[spr_sprite_font]the quick brown fox [wave]jumps[/wave] over the lazy dog";
demo_string += "[fnt_test_0][fa_right]THE [fnt_test_1][#ff4499][shake]QUICK[fnt_test_0] [$D2691E]BROWN [$FF4499]FOX [fa_left]JUMPS OVER[$FFFF00] [/shake]THE LAZY [fnt_test_1][wobble]DOG[/wobble].";
demo_string += "##[fnt_test_2][c_black]TESTING";
//demo_string = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabcaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
//demo_string += "[rainbow][pulse]TEST[] [slant]AaBbCcDdEeFf[/slant]##";
//demo_string += "a b c d e f g h i j k l m n o p q r s t u v w x y z\n\n";
//demo_string += "[wave][c_orange]0123456789[] .,<>\"'&[c_white][spr_coin,0][spr_coin,1][spr_coin,2][spr_coin,3][][shake][rainbow]!?[]\n";
//demo_string += "[spr_coin][spr_coin,1,0.1][spr_coin,2,0.1][spr_large_coin,3,0.1] \n";
//demo_string += "[spr_sprite_font]the quick brown fox [wave]jumps[/wave] over the lazy dog";
//demo_string += "[fnt_test_0][fa_right]THE [fnt_test_1][#ff4499][shake]QUICK[fnt_test_0] [$D2691E]BROWN [$FF4499]FOX [fa_left]JUMPS OVER[$FFFF00] [/shake]THE LAZY [fnt_test_1][wobble]DOG[/wobble].";
//demo_string += "##[fnt_test_2][c_black]TESTING";

demo_string = "Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of \"de Finibus Bonorum et Malorum\" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, \"Lorem ipsum dolor sit amet...\", comes from a line in section 1.10.32.";

//Now parse the string to make some Scribble data
//We're using a cache group called "example cache group" to indicate we want to manage this memory ourselves
scribble_draw_set_cache_group("example cache group", false, true);
scribble_draw_set_wrap(-1, 450, false);
scribble_draw_set_wrap(-1, 450, 100, false);
element = scribble_draw(0, 0, demo_string);
scribble_autotype_fade_in(element, SCRIBBLE_AUTOTYPE_PER_CHARACTER, 2, 0);
scribble_page_set(element, 0);
scribble_autotype_fade_in(element, SCRIBBLE_AUTOTYPE_PER_CHARACTER, 1, 10);

//Don't forget to reset the state otherwise all subsequent Scribble text elements will inherit these settings
scribble_draw_reset();
Loading

0 comments on commit ff388a4

Please sign in to comment.