From 7effb5f3b17bde08a5a4dcca6ab5789d2d980c47 Mon Sep 17 00:00:00 2001 From: Ivan Mahonin Date: Aug 01 2020 20:25:59 +0000 Subject: update --- diff --git a/data/fonts/blackcha.txt b/data/fonts/blackcha.txt new file mode 100644 index 0000000..99305e4 --- /dev/null +++ b/data/fonts/blackcha.txt @@ -0,0 +1,29 @@ +Black Chancery font +version of 11/19/91 by Earl Allen/Doug Miles +(Includes both PostScript and TrueType outlines) +----------------- + +Black Chancery is a calligraphic outline font based on the public domain bitmap font of the same name. It's a good looking and useful display font, lending itself well to many occasions. And a suitable companion to Black Chancery Italic. + +Black Chancery began, several years ago, as a modification of Bill Horton�s lovely FancyChancery 24 point bitmap, which had random dots missing from within the letters to give the effect of snow falling in front of them. (Rather like his Palazzo Grey font, part of Casady�s bitmap Fluent Fonts). Doug Miles filled in the dots, did some restyling, made five additional large point sizes, and gave it a new name. + +Earl Allen of Altsys Corp. used Fontographer 3.2 to autotrace the BlackChancery bitmaps to make PostScript Type 1 outlines, cleaned them up, adjusted character spacing and added kerning pairs. Doug Miles further cleaned-up the outlines, removing unneeded control points, adjusted the height and baseline positions of most characters, resized some of them, added accented letters and other option characters. He converted the numbers to "old style" figures, probably more appropriate for this font. + +(Note that Bill Horton has made his own public domain PostScript version of BlackChancery, considerably restyled and called MacHumaine. It's more angular looking, more faithful to actual hand-done broad-pen calligraphy. This extended the remarkable uncoordinated collaborative effort full circle, from his FancyChancery bitmaps, to Doug's BlackChancery version, to PostScript outlines by Marion Delahan, and back to Bill!) + +There is an optional lowercase j available by pressing Option-j, if you prefer a different style. There are now ligatures of ct and st at Option-comma and Option-period, and of course the ligatures of fi and fl are in their standard locations at Option-5 and Option-6. + +BlackChancery is great for headlines, letterheads, greeting cards. Wherever used, it adds an old-world elegance to your printed page. + + +11/19/91 Revisons: +Replaced all accented characters with composites +Changed ', ", �, a, d, g, q; f, �, �; �, �; reduced size of most accents by 15%. +Moved to right by 5 ems: p (1250 ems to the em-square) +Moved to right by 10 ems: i, �, l, t, u +Moved to right by 15 ems: b, h, k, m, n, r +Moved to left and narrowed by 30 ems: x +Moved to left and narrowed by 70 ems: v, w, y +Added 50 ems of leading, which had been 0. +Fixed a lot of little things here and there in conjunction with making the italic version. + diff --git a/data/fonts/blackcry.ttf b/data/fonts/blackcry.ttf new file mode 100644 index 0000000..cca5091 Binary files /dev/null and b/data/fonts/blackcry.ttf differ diff --git a/snake.c b/snake.c index 7df970d..97ae3e5 100644 --- a/snake.c +++ b/snake.c @@ -45,12 +45,14 @@ int difficulty; int mode; -char *tileWall = "data/sprite/bricks.png"; -char *tileFood = "data/sprite/apple.png"; -char *tileHead = "data/sprite/snake/head.png"; -char *tileBody = "data/sprite/snake/body.png"; -char *tileBend = "data/sprite/snake/bend.png"; -char *tileTail = "data/sprite/snake/tail.png"; +Animation tileWall; +Animation tileFood; +Animation tileHead; +Animation tileBody; +Animation tileBend; +Animation tileTail; + +Font font; void putFood() { @@ -70,7 +72,7 @@ void setSnakeTile(int i) { int x = snake[i][0]; int y = snake[i][1]; Sprite s = sprites[x][y]; - char *tile = tileBody; + Animation tile = tileBody; double rotation = 0; int left = FALSE; @@ -257,12 +259,18 @@ void restart() { void init() { - worldSetWidth(SIZE * WIDTH); - worldSetHeight(SIZE * HEIGHT); - worldSetFrameRate(FRAMERATE); + tileWall = createAnimation("data/sprite/bricks.png"); + tileFood = createAnimation("data/sprite/apple.png"); + tileHead = createAnimation("data/sprite/snake/head.png"); + tileBody = createAnimation("data/sprite/snake/body.png"); + tileBend = createAnimation("data/sprite/snake/bend.png"); + tileTail = createAnimation("data/sprite/snake/tail.png"); + + font = createFont("data/fonts/blackcry.ttf"); + textFont(font); storage = createGroup(); - char *tiles[6] = { tileWall, tileFood, tileHead, tileBody, tileBend, tileTail }; + Animation tiles[6] = { tileWall, tileFood, tileHead, tileBody, tileBend, tileTail }; for(int i = 0; i < 6; ++i) { Sprite s = createSprite(0, 0); spriteSetAnimation(s, tiles[i]); @@ -274,7 +282,7 @@ void init() { for(int x = 0; x < WIDTH; ++x) { for(int y = 0; y < HEIGHT; ++y) { Sprite s = createSpriteEx((x + 0.5)*SIZE, (y + 0.5)*SIZE, SIZE, SIZE); - spriteSetShapeColor(s, "transparent"); + spriteSetShapeColor(s, colorByName("transparent")); groupAdd(gridGroup, s); sprites[x][y] = s; } @@ -309,9 +317,10 @@ void draw() { if (mode == GAMEOVER) { drawSprites(); - fill(rgba(1, 1, 1, 0.25)); + fill(colorByRGBA(1, 1, 1, 0.25)); rect(0, 0, worldGetWidth(), worldGetHeight()); + noFill(); textAlign(HALIGN_CENTER, HALIGN_CENTER); textSize(24); text("Game Over", cx, cy); @@ -323,9 +332,10 @@ void draw() { if (mode == START) { drawSprites(); - fill(rgba(1, 1, 1, 0.25)); + fill(colorByRGBA(1, 1, 1, 0.25)); rect(0, 0, worldGetWidth(), worldGetHeight()); + noFill(); textAlign(HALIGN_CENTER, VALIGN_CENTER); textSize(24); text("Press enter to start", cx, cy); @@ -333,6 +343,7 @@ void draw() { if (keyWentDown("escape")) mode = MENU; } else if (mode == MENU) { + noFill(); textAlign(HALIGN_LEFT, VALIGN_CENTER); textSize(24); int x = cx - 100; @@ -355,6 +366,9 @@ void draw() { } int main() { + worldSetWidth(SIZE * WIDTH); + worldSetHeight(SIZE * HEIGHT); + worldSetFrameRate(FRAMERATE); worldSetInit(&init); worldSetDraw(&draw); worldRun();