Mid prog font
This commit is contained in:
@ -10,16 +10,50 @@
|
||||
#include "scene/components/ui/UIImage.hpp"
|
||||
#include "display/font/BitmapFont.hpp"
|
||||
|
||||
#include "display/font/NewTrueType.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class HelloWorldScene : public Scene {
|
||||
protected:
|
||||
Camera *camera;
|
||||
SimpleSpinningCubePrefab *cube;
|
||||
FT_Face face;
|
||||
Texture texture;
|
||||
std::map<FT_ULong, struct TrueTypeCharacterInfo> charStore;
|
||||
|
||||
SceneItem *item;
|
||||
|
||||
void stage() override {
|
||||
camera = Camera::create(this);
|
||||
camera->transform->lookAt(glm::vec3(3, 3, 3), glm::vec3(0, 0, 0));
|
||||
cube = SimpleSpinningCubePrefab::create(this);
|
||||
|
||||
// cube = SimpleSpinningCubePrefab::create(this);
|
||||
|
||||
item = this->createSceneItem();
|
||||
auto meshRenderer = item->addComponent<MeshRenderer>();
|
||||
auto quadMeshHost = item->addComponent<QuadMeshHost>();
|
||||
auto material = item->addComponent<SimpleTexturedMaterial>();
|
||||
|
||||
if(FT_New_Face(
|
||||
this->game->renderManager.getFontManager()->fontLibrary,
|
||||
"C:\\Windows\\Fonts\\Arial.ttf",
|
||||
0,
|
||||
&face
|
||||
)) {
|
||||
assertUnreachable();
|
||||
}
|
||||
if(FT_Set_Pixel_Sizes(face, 0, 16)) {
|
||||
assertUnreachable();
|
||||
}
|
||||
|
||||
_newTrueTypePlaceholder(face, texture, charStore);
|
||||
FT_ULong c = 'B';
|
||||
auto x = charStore[c];
|
||||
glm::vec2 wh = glm::vec2(texture.getWidth(), texture.getHeight());
|
||||
quadMeshHost->uv0 = glm::vec2(0.0f, x.textureY) / wh;
|
||||
quadMeshHost->uv1 = (glm::vec2)quadMeshHost->uv0 + (x.bitmapSize / wh);
|
||||
std::cout << "Done" << std::endl;
|
||||
material->texture = &texture;
|
||||
}
|
||||
|
||||
std::vector<Asset*> getRequiredAssets() override {
|
||||
|
Reference in New Issue
Block a user