Implement font upscaling hack for similar looking web/PC font rendering.
This commit is contained in:
parent
f9b00a8931
commit
5331a3d443
@ -39,7 +39,7 @@ All rights reserved.
|
|||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 2
|
#define VERSION_MINOR 2
|
||||||
#define VERSION_PATCH 1
|
#define VERSION_PATCH 1
|
||||||
#define VERSION_BUILD 3283
|
#define VERSION_BUILD 3285
|
||||||
|
|
||||||
#define stringify(a) stringify_(a)
|
#define stringify(a) stringify_(a)
|
||||||
#define stringify_(a) #a
|
#define stringify_(a) #a
|
||||||
|
@ -61,7 +61,7 @@ story_background_image_location = backgrounds/
|
|||||||
story_player_name = You
|
story_player_name = You
|
||||||
|
|
||||||
# Dialog font and size.
|
# Dialog font and size.
|
||||||
dialog_font_size = LessRoundBox,24
|
dialog_font_size = LessRoundBox,12
|
||||||
|
|
||||||
# Whether or not to show individual data accesses from config data structure.
|
# Whether or not to show individual data accesses from config data structure.
|
||||||
debug_access_options = 0
|
debug_access_options = 0
|
||||||
|
@ -73,7 +73,7 @@ namespace olc {
|
|||||||
Font(std::string path, int fontSize) : fontSize(fontSize) {
|
Font(std::string path, int fontSize) : fontSize(fontSize) {
|
||||||
FT_Error error = FT_New_Face(library, path.c_str(), 0, &fontFace);
|
FT_Error error = FT_New_Face(library, path.c_str(), 0, &fontFace);
|
||||||
|
|
||||||
error = FT_Set_Pixel_Sizes(fontFace, 0, fontSize);
|
error = FT_Set_Pixel_Sizes(fontFace, 0, fontSize*4);
|
||||||
}
|
}
|
||||||
|
|
||||||
Font(const Font &other) = delete;
|
Font(const Font &other) = delete;
|
||||||
@ -114,7 +114,7 @@ namespace olc {
|
|||||||
|
|
||||||
for (size_t i = 0; i < string.size(); i++) {
|
for (size_t i = 0; i < string.size(); i++) {
|
||||||
char32_t chr = string[i];
|
char32_t chr = string[i];
|
||||||
|
if(chr=='\r')continue;
|
||||||
|
|
||||||
Font *toUse = this;
|
Font *toUse = this;
|
||||||
FT_UInt chrIndex = GetCharIndex(chr);
|
FT_UInt chrIndex = GetCharIndex(chr);
|
||||||
@ -261,7 +261,7 @@ namespace olc {
|
|||||||
public:
|
public:
|
||||||
FontRect GetStringBounds(std::u32string string, float angle = 0.0f) {
|
FontRect GetStringBounds(std::u32string string, float angle = 0.0f) {
|
||||||
FontRect temp=_GetStringBounds(string,angle);
|
FontRect temp=_GetStringBounds(string,angle);
|
||||||
return {temp.offset/2,{temp.size/2}};
|
return {temp.offset/4,{temp.size/4}};
|
||||||
}
|
}
|
||||||
|
|
||||||
olc::Sprite *RenderStringToSprite(std::u32string string,
|
olc::Sprite *RenderStringToSprite(std::u32string string,
|
||||||
|
@ -3345,7 +3345,7 @@ namespace olc
|
|||||||
delete temp;
|
delete temp;
|
||||||
}
|
}
|
||||||
temp=font.RenderStringToDecal(sText,col);
|
temp=font.RenderStringToDecal(sText,col);
|
||||||
DrawDecal(pos,temp,scale/2,col);
|
DrawDecal(pos,temp,scale/4,col);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PixelGameEngine::DrawShadowStringDecal(Font&font, const olc::vf2d& pos, const std::u32string& sText, const Pixel col, const Pixel shadowCol, const olc::vf2d& scale,const float shadowSizeFactor){
|
void PixelGameEngine::DrawShadowStringDecal(Font&font, const olc::vf2d& pos, const std::u32string& sText, const Pixel col, const Pixel shadowCol, const olc::vf2d& scale,const float shadowSizeFactor){
|
||||||
@ -3358,11 +3358,11 @@ namespace olc
|
|||||||
for(float y=-shadowSizeFactor;y<=shadowSizeFactor+0.1;y+=shadowSizeFactor/2){
|
for(float y=-shadowSizeFactor;y<=shadowSizeFactor+0.1;y+=shadowSizeFactor/2){
|
||||||
for(float x=-shadowSizeFactor;x<=shadowSizeFactor+0.1;x+=shadowSizeFactor/2){
|
for(float x=-shadowSizeFactor;x<=shadowSizeFactor+0.1;x+=shadowSizeFactor/2){
|
||||||
if(x!=0||y!=0){
|
if(x!=0||y!=0){
|
||||||
DrawDecal(pos+vf2d{x,y},temp,scale/2,shadowCol);
|
DrawDecal(pos+vf2d{x,y},temp,scale/4,shadowCol);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DrawDecal(pos,temp,scale/2,col);
|
DrawDecal(pos,temp,scale/4,col);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PixelGameEngine::DrawShadowStringPropDecal(const olc::vf2d& pos, const std::string& sText, const Pixel col, const Pixel shadowCol, const olc::vf2d& scale,const float shadowSizeFactor){
|
void PixelGameEngine::DrawShadowStringPropDecal(const olc::vf2d& pos, const std::string& sText, const Pixel col, const Pixel shadowCol, const olc::vf2d& scale,const float shadowSizeFactor){
|
||||||
|
BIN
Crawler/pge.data
BIN
Crawler/pge.data
Binary file not shown.
Before Width: | Height: | Size: 9.2 MiB After Width: | Height: | Size: 9.3 MiB |
File diff suppressed because one or more lines are too long
BIN
Crawler/pge.wasm
BIN
Crawler/pge.wasm
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user