diff --git a/.bin/.gitignore b/.bin/.gitignore index 937d6c9..b293415 100644 --- a/.bin/.gitignore +++ b/.bin/.gitignore @@ -1,4 +1,3 @@ * !/.gitignore -!/fonts !/songs diff --git a/.bin/fonts/SourceHanSansJP-Heavy.otf b/.bin/fonts/SourceHanSansJP-Heavy.otf deleted file mode 100644 index 4558d3c..0000000 Binary files a/.bin/fonts/SourceHanSansJP-Heavy.otf and /dev/null differ diff --git a/src/sj/Font.d b/src/sj/Font.d deleted file mode 100644 index ba0da39..0000000 --- a/src/sj/Font.d +++ /dev/null @@ -1,69 +0,0 @@ -/// License: MIT -module sj.Font; - -import std.array, - std.conv, - std.exception, - std.format, - std.string; - -import derelict.sfml2.graphics; - -import gl4d; - -/// -class Font { - public: - /// - this(string path) { - font_ = sfFont_createFromFile(path.toStringz). - enforce("failed creating font from %s".format(path)); - } - ~this() { - sfFont_destroy(font_); - } - - /// - vec2i[] CreateTextureUvArray(dstring str, size_t px) { - auto glyphs = appender!(sfGlyph[]); - glyphs.reserve(str.length); - foreach (c; str) { - glyphs ~= sfFont_getGlyph(font_, c, px.to!uint, false, 0f); - } - - auto uv = appender!(vec2i[]); - uv.reserve(str.length * 4); - foreach (const ref g; glyphs[]) { - const rc = &g.textureRect; - - const left = rc.left; - const right = (rc.left + rc.width); - const top = rc.top; - const bottom = (rc.top + rc.height); - - uv ~= [ - vec2i(left, top), - vec2i(left, bottom), - vec2i(right, bottom), - vec2i(right, top), - ]; - } - return uv[]; - } - - /// - vec2i GetTextureSize(size_t px) { - const sz = sfTexture_getSize( - sfFont_getTexture(font_, px.to!uint).enforce); - return vec2i(sz.x, sz.y); - } - - /// - void BindTextureToUnit(GLenum unit, size_t px) { - gl.ActiveTexture(unit); - sfTexture_bind(sfFont_getTexture(font_, px.to!uint).enforce); - } - - private: - sfFont* font_; -} diff --git a/src/sj/FontSet.d b/src/sj/FontSet.d deleted file mode 100644 index b312663..0000000 --- a/src/sj/FontSet.d +++ /dev/null @@ -1,29 +0,0 @@ -/// License: MIT -module sj.FontSet; - -import std.file, - std.path; - -import sj.Font; - -/// -class FontSet { - public: - /// - this() { - const dir = thisExePath.dirName; - - gothic_heavy_ = new Font(dir~"/fonts/SourceHanSansJP-Heavy.otf"); - } - ~this() { - gothic_heavy_.destroy(); - } - - /// - @property Font gothicHeavy() { - return gothic_heavy_; - } - - private: - Font gothic_heavy_; -} diff --git a/src/sj/Game.d b/src/sj/Game.d index 708f68b..d6a0551 100644 --- a/src/sj/Game.d +++ b/src/sj/Game.d @@ -7,7 +7,6 @@ import std.algorithm, std.path; import sj.AbstractGame, - sj.FontSet, sj.LobbyWorld, sj.ProgramSet, sj.SelectScene, @@ -26,7 +25,6 @@ class Game : AbstractGame { songs_ = Song.CreateFromJson(songs_list.parseJSON, songs_dir); programs_ = new ProgramSet; - fonts_ = new FontSet; lobby_ = new LobbyWorld(programs_); @@ -46,7 +44,6 @@ class Game : AbstractGame { lobby_.destroy(); programs_.destroy(); - fonts_.destroy(); songs_.each!destroy(); } @@ -56,8 +53,6 @@ class Game : AbstractGame { ProgramSet programs_; - FontSet fonts_; - LobbyWorld lobby_; TitleScene title_;