generated from sigonasr2/CPlusPlusProjectTemplate
Incorporate game font.
This commit is contained in:
parent
25a798cf7e
commit
b3434e9fad
TiledCollisionEditor
BIN
TiledCollisionEditor/font.png
Normal file
BIN
TiledCollisionEditor/font.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 5.1 KiB |
@ -23,6 +23,8 @@ public:
|
|||||||
public:
|
public:
|
||||||
bool OnUserCreate() override
|
bool OnUserCreate() override
|
||||||
{
|
{
|
||||||
|
SetFontSprite("font.png");
|
||||||
|
|
||||||
std::string tilesetFilename=TILESET_DIR+"Basic Tileset.tsx";
|
std::string tilesetFilename=TILESET_DIR+"Basic Tileset.tsx";
|
||||||
Tileset&tileset=tilesets[tilesetFilename]=TSXParser{tilesetFilename}.GetData();
|
Tileset&tileset=tilesets[tilesetFilename]=TSXParser{tilesetFilename}.GetData();
|
||||||
|
|
||||||
@ -75,6 +77,13 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Font test.
|
||||||
|
DrawStringDecal({0,0},"the quick brown fox jumps over the lazy dog",WHITE,{1.5f,1.5f});
|
||||||
|
DrawStringDecal({0,18},"THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG",WHITE,{1.5f,1.5f});
|
||||||
|
DrawStringPropDecal({0,36},"the quick brown fox jumps over the lazy dog",WHITE,{1.5f,1.5f});
|
||||||
|
DrawStringPropDecal({0,54},"THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG",WHITE,{1.5f,1.5f});
|
||||||
|
*/
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1154,6 +1154,7 @@ namespace olc
|
|||||||
void ClearBuffer(Pixel p, bool bDepth = true);
|
void ClearBuffer(Pixel p, bool bDepth = true);
|
||||||
// Returns the font image
|
// Returns the font image
|
||||||
olc::Sprite* GetFontSprite();
|
olc::Sprite* GetFontSprite();
|
||||||
|
void SetFontSprite(std::string_view newFontFile);
|
||||||
|
|
||||||
// Clip a line segment to visible area
|
// Clip a line segment to visible area
|
||||||
bool ClipLineToScreen(olc::vi2d& in_p1, olc::vi2d& in_p2);
|
bool ClipLineToScreen(olc::vi2d& in_p1, olc::vi2d& in_p2);
|
||||||
@ -2377,6 +2378,9 @@ namespace olc
|
|||||||
olc::Sprite* PixelGameEngine::GetFontSprite()
|
olc::Sprite* PixelGameEngine::GetFontSprite()
|
||||||
{ return fontRenderable.Sprite(); }
|
{ return fontRenderable.Sprite(); }
|
||||||
|
|
||||||
|
void PixelGameEngine::SetFontSprite(std::string_view newFontFile)
|
||||||
|
{ fontRenderable.Load(std::string(newFontFile)); }
|
||||||
|
|
||||||
bool PixelGameEngine::ClipLineToScreen(olc::vi2d& in_p1, olc::vi2d& in_p2)
|
bool PixelGameEngine::ClipLineToScreen(olc::vi2d& in_p1, olc::vi2d& in_p2)
|
||||||
{
|
{
|
||||||
// https://en.wikipedia.org/wiki/Cohen%E2%80%93Sutherland_algorithm
|
// https://en.wikipedia.org/wiki/Cohen%E2%80%93Sutherland_algorithm
|
||||||
@ -4071,8 +4075,8 @@ namespace olc
|
|||||||
0x08,0x17,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x24,0x15,0x06,0x07,0x16,0x17,
|
0x08,0x17,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x24,0x15,0x06,0x07,0x16,0x17,
|
||||||
0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x17,0x08,0x08,0x17,0x08,0x08,0x08,
|
0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x17,0x08,0x08,0x17,0x08,0x08,0x08,
|
||||||
0x08,0x08,0x08,0x08,0x17,0x08,0x08,0x08,0x08,0x17,0x08,0x15,0x08,0x15,0x08,0x08,
|
0x08,0x08,0x08,0x08,0x17,0x08,0x08,0x08,0x08,0x17,0x08,0x15,0x08,0x15,0x08,0x08,
|
||||||
0x24,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x33,0x17,0x17,0x33,0x18,0x17,0x17,
|
0x24,0x16,0x16,0x17,0x16,0x16,0x15,0x17,0x17,0x33,0x15,0x17,0x23,0x08,0x17,0x16,
|
||||||
0x17,0x17,0x17,0x17,0x07,0x17,0x17,0x18,0x18,0x17,0x17,0x07,0x33,0x07,0x08,0x00, } };
|
0x07,0x07,0x24,0x17,0x06,0x17,0x16,0x08,0x23,0x17,0x17,0x07,0x33,0x07,0x08,0x00, } };
|
||||||
|
|
||||||
for (auto c : vSpacing) vFontSpacing.push_back({ c >> 4, c & 15 });
|
for (auto c : vSpacing) vFontSpacing.push_back({ c >> 4, c & 15 });
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user