diff --git a/fonts/IllusionBook/IllusionBook-Regular.otf b/fonts/IllusionBook/IllusionBook-Regular.otf new file mode 100644 index 0000000..77d62ad Binary files /dev/null and b/fonts/IllusionBook/IllusionBook-Regular.otf differ diff --git a/fonts/IllusionBook/IllusionBook-Regular.otf.import b/fonts/IllusionBook/IllusionBook-Regular.otf.import new file mode 100644 index 0000000..0a5e0db --- /dev/null +++ b/fonts/IllusionBook/IllusionBook-Regular.otf.import @@ -0,0 +1,41 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://bnodbj3rhtd8v" +path="res://.godot/imported/IllusionBook-Regular.otf-a48250df46ace3f831871b997ec2974c.fontdata" + +[deps] + +source_file="res://fonts/IllusionBook/IllusionBook-Regular.otf" +dest_files=["res://.godot/imported/IllusionBook-Regular.otf-a48250df46ace3f831871b997ec2974c.fontdata"] + +[params] + +Rendering=null +antialiasing=0 +generate_mipmaps=false +disable_embedded_bitmaps=true +multichannel_signed_distance_field=false +msdf_pixel_range=8 +msdf_size=48 +allow_system_fallback=false +force_autohinter=false +hinting=2 +subpixel_positioning=0 +keep_rounding_remainders=true +oversampling=0.0 +Fallbacks=null +fallbacks=[] +Compress=null +compress=true +preload=[{ +"chars": [], +"glyphs": [], +"name": "New Configuration", +"size": Vector2i(16, 0), +&"variation_embolden": 0.0 +}] +language_support={} +script_support={} +opentype_features={} diff --git a/fonts/IllusionBook/LICENSE.md b/fonts/IllusionBook/LICENSE.md new file mode 100644 index 0000000..893c734 --- /dev/null +++ b/fonts/IllusionBook/LICENSE.md @@ -0,0 +1,95 @@ + +Copyright (c) 2024, Steven Liu (mojang1314@outlook.com), +with Reserved Font Name Illusion Book. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://openfontlicense.org + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/fonts/IllusionBook/README.md b/fonts/IllusionBook/README.md new file mode 100644 index 0000000..542c90c --- /dev/null +++ b/fonts/IllusionBook/README.md @@ -0,0 +1,72 @@ +![banner](docs/Cover(640x320).png) + + # 幻象像素书体 Illusion Book +> 一款尝试在像素世界中寻铅字时代的温润的字体。 + +[![License OFL](https://img.shields.io/badge/license-OFL--1.1-orange)](https://openfontlicense.org) +[![Realeases](https://img.shields.io/badge/releases-v1.0-blue)](https://github.com/StevenLZH/IllusionBook/releases/) +[![Itch.io](https://img.shields.io/badge/itch.io-illusion--book-FF2449?logo=itch.io&logoColor=white)](https://steven-liu.itch.io/illusion-book) + +> [!WARNING] +> +> 由于目前仍在学习字体技术,所以该字体可能或多或少的会包含一些错误。 +> +> 如果在使用过程中发现了错误,请及时在 Issues 中反馈。 + +> [!IMPORTANT] +> +> 这是一个开源项目,字体可以免费商用。 +> +> 如果这个项目对您有帮助,请考虑在 [爱发电](#) 或 [Patreon](#) 上来支持开发工作。 + +## 预览 Preview +请参见 [itch.io](#),[Behance](#) 或该字体的 [主页](#)。 + +## 注意事项 Notice +由于本字体在字距调整时并未完全采用整数倍单元格大小的数值,这可能导致在某些情况下字体不能正确地渲染。在允许的情况下,请关闭任何的抗锯齿设置以及过滤模式,并将字距微调和追踪皆设为`0`。 + +## 涵盖的字符集 Covered Character Sets +- 基本拉丁语 +- 拉丁语增补 +- 拉丁语扩展-A +- 希腊语和科普特语 +- 西里尔字母 +- 西里尔字母补充; + +以及零星的 + +- 拉丁语扩展-B +- 拉丁语扩充增补 +- 广义标点 +- 货币符号 +- 类似字母的符号 +- 数学运算符。 + +## OpenType 特性 OpenType Features +- 标准连字`liga` +- 自由连字`dlig` +- 历史连字`hlig` +- 斜线零`zero` +- 小型大写`smcp` +- 大写转小型大写`c2sc` +- 旧式数字`onum` +- 历史形式`hist` +- 上下文替换`calt` +- 词尾样式`fina` +- 花饰字`swsh` +- 字偶距`kern` + +## 尺寸 Size +该字体基于 12px 的大小设计。 + +字体的 `UPM`(`Units Per Em`,每个字面框包含的设计单位的数量)按照像素尺寸的 100 倍来转化,即:`1 px = 100 units` 。 + +该字体的 `UPM` 为 `1200`,故为了保证最佳的渲染效果,请以 12 的整数倍对字体进行缩放。 + +## 授权许可 License +本字体采用的是 [SIL 开源字体协议](https://openfontlicense.org/)。 + +## 程序依赖 Program Dependencies +- [FontForge](https://github.com/fontforge/fontforge) +- [AFDKO](https://github.com/adobe-type-tools/afdko) +- [Aseprite](https://github.com/aseprite/aseprite) diff --git a/project.godot b/project.godot index c86d65a..2c246dc 100644 --- a/project.godot +++ b/project.godot @@ -27,6 +27,13 @@ SCENE_MANAGER="*res://scripts/Singleton/SceneManager.gd" UI="*res://scenes/Singletons/UI.tscn" VN="*res://scripts/Singleton/VN.gd" +[display] + +window/size/viewport_width=480 +window/size/viewport_height=270 +window/stretch/mode="viewport" +window/stretch/scale_mode="integer" + [dotnet] project/assembly_name="Dawn Godot" @@ -35,6 +42,12 @@ project/assembly_name="Dawn Godot" import/blender/enabled=false +[gui] + +fonts/dynamic_fonts/use_oversampling=false +theme/custom="uid://dm7ee4aqjr2dl" +theme/custom_font="uid://bnodbj3rhtd8v" + [input] left={ @@ -94,5 +107,6 @@ run={ [rendering] +textures/canvas_textures/default_texture_filter=0 renderer/rendering_method="gl_compatibility" renderer/rendering_method.mobile="gl_compatibility" diff --git a/scenes/Entities/Rosa.tscn b/scenes/Entities/Rosa.tscn index 41a496d..c00bac5 100644 --- a/scenes/Entities/Rosa.tscn +++ b/scenes/Entities/Rosa.tscn @@ -22,10 +22,11 @@ shader_parameter/direction = 1 [node name="Rosa" type="CharacterBody3D"] script = ExtResource("1_3g383") -[node name="Rosa Camera" type="Camera3D" parent="."] +[node name="Rosa Camera" type="Camera3D" parent="." node_paths=PackedStringArray("follow")] transform = Transform3D(1, 0, 0, 0, 0.130388, 0.991463, 0, -0.991463, 0.130388, 0, 3.14994, 0.404846) fov = 30.0 script = ExtResource("2_tr66j") +follow = NodePath("..") [node name="CollisionShape3D" type="CollisionShape3D" parent="."] shape = SubResource("CapsuleShape3D_ls7r8") diff --git a/scenes/Maps/TestMap/TestMap.tscn b/scenes/Maps/TestMap/TestMap.tscn index fd905b0..15214e1 100644 --- a/scenes/Maps/TestMap/TestMap.tscn +++ b/scenes/Maps/TestMap/TestMap.tscn @@ -22,10 +22,9 @@ sky_material = SubResource("ProceduralSkyMaterial_e1h75") sky = SubResource("Sky_weucl") ambient_light_source = 1 -[node name="TestMap" type="Node3D" node_paths=PackedStringArray("mapEnterEvent")] +[node name="TestMap" type="Node3D"] script = ExtResource("1_ru75d") mapName = "My cool map" -mapEnterEvent = NodePath("") [node name="WorldEnvironment" type="WorldEnvironment" parent="."] environment = SubResource("Environment_nyivo") diff --git a/scenes/UI/DebugMenu.tscn b/scenes/UI/DebugMenu.tscn index da81547..9e41dea 100644 --- a/scenes/UI/DebugMenu.tscn +++ b/scenes/UI/DebugMenu.tscn @@ -11,7 +11,7 @@ script = ExtResource("1_pcsq6") [node name="MainMenu" type="Button" parent="."] layout_mode = 2 -text = "Prototype Main Menu" +text = "Prototype Main Menub" [node name="OverworldOption" type="HBoxContainer" parent="."] layout_mode = 2 diff --git a/scripts/Entity/RosaCamera.gd b/scripts/Entity/RosaCamera.gd index 989c77c..190ab84 100644 --- a/scripts/Entity/RosaCamera.gd +++ b/scripts/Entity/RosaCamera.gd @@ -1,6 +1,8 @@ extends Camera3D -const PIXEL_SCALE:float = 2.0; +@export var pixelScale:float = 1.0; +@export var follow:Node; + const WORLD_UNITS:float = 32.0; func _ready() -> void: @@ -8,17 +10,20 @@ func _ready() -> void: func _process(delta: float) -> void: + # I tried a few things but this is most consistent for both backbuffer and + # framebuffer viewports. + var viewportHeight = get_viewport().get_visible_rect().size.y; + var unitScale = pixelScale * WORLD_UNITS; + var z:float = ( tan((deg_to_rad(180) - deg_to_rad(fov)) / 2.0) * - (get_viewport().size.y / 2.0) - ) / PIXEL_SCALE / WORLD_UNITS; + (viewportHeight / 2.0) + ) / unitScale; - var rosa = get_node(".."); - var look = rosa.position; + var look = follow.position; var position = Vector3(0, 0, 2) + look; + look_at_from_position( Vector3(position.x, position.y + z, position.z), look ); - - pass diff --git a/shaders/NPC Shader.gdshader b/shaders/NPC Shader.gdshader index 2bd281f..8df3fd4 100644 --- a/shaders/NPC Shader.gdshader +++ b/shaders/NPC Shader.gdshader @@ -8,6 +8,7 @@ uniform int direction; const int FRAMES = 1; const int DIRECTIONS = 4; +const float PIXEL_UNIT = 1.0 / 32.0; // Define pixel-perfect unit void vertex() { vec2 tileSize = vec2(1.0 / float(DIRECTIONS), 1.0 / float(FRAMES)); @@ -26,6 +27,9 @@ void vertex() { } else if(VERTEX_ID == 0) { UV = bottomRight; } + + // Round UV to the nearest pixel-perfect unit + UV = floor(UV / PIXEL_UNIT + 0.5) * PIXEL_UNIT; } void fragment() { diff --git a/ui/UI Theme.tres b/ui/UI Theme.tres index 11f8631..7eb6d49 100644 --- a/ui/UI Theme.tres +++ b/ui/UI Theme.tres @@ -9,6 +9,9 @@ axis_stretch_horizontal = 1 axis_stretch_vertical = 1 [resource] +Button/font_sizes/font_size = 12 +Label/constants/shadow_offset_y = 1 +Label/font_sizes/font_size = 12 MarginContainer/constants/margin_bottom = 8 MarginContainer/constants/margin_left = 8 MarginContainer/constants/margin_right = 8