本文整理汇总了C++中FontFace::setStyle方法的典型用法代码示例。如果您正苦于以下问题:C++ FontFace::setStyle方法的具体用法?C++ FontFace::setStyle怎么用?C++ FontFace::setStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FontFace
的用法示例。
在下文中一共展示了FontFace::setStyle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FontFamily
BasicSceneExample::BasicSceneExample(int argc, const char* argv[]):
ExampleApplication("Basic Scene", argc, argv)
{
// Open Sans
openSans = new FontFamily(resourceContext->getFontManager());
openSans->setName("Open Sans");
FontFace* openSansRegular = openSans->createFontFace();
openSansRegular->setSource("data/fonts/Open_Sans/OpenSans-Regular.ttf");
FontFace* openSansItalic = openSans->createFontFace();
openSansItalic->setSource("data/fonts/Open_Sans/OpenSans-Italic.ttf");
openSansItalic->setStyle(FontStyle::ITALIC);
FontFace* openSansBold = openSans->createFontFace();
openSansBold->setSource("data/fonts/Open_Sans/OpenSans-Bold.ttf");
openSansBold->setWeight(FontWeight::BOLD);
FontFace* openSansBoldItalic = openSans->createFontFace();
openSansBoldItalic->setSource("data/fonts/Open_Sans/OpenSans-BoldItalic.ttf");
openSansBoldItalic->setStyle(FontStyle::ITALIC);
openSansBoldItalic->setWeight(FontWeight::BOLD);
SharedFont font = openSansItalic->getFont(22);
if (!font)
{
std::cerr << "Failed to find font.\n";
}
// Load meshes
object = resourceContext->getMeshManager()->load("data/models/Hexapod.mesh");
lightMesh = resourceContext->getMeshManager()->load("data/models/circle.obj");
checker = resourceContext->getImageManager()->load("data/textures/checker2.tga", true);
//scene.addChild(new AmbientCubeNode(&ambientCube));
floor = resourceContext->getMeshManager()->load("data/models/CheckerFloor.obj");
// Setup camera
camera.setLens(20.0f, 24.0f);
camera.setAspectRatio(graphicsContext->getViewport().getAspectRatio());
camera.setClipNear(0.1f);
camera.setClipFar(100.0f);
camera.lookAt(
{0.0f, 0.0f, 3.0f},
{0.0f, 0.0f, 0.0f},
{0.0f, 1.0f, 0.0f});
camera.update();
orthoCamera.setClipTop(0.0f);
orthoCamera.setClipLeft(0.0f);
orthoCamera.setClipBottom(window->getHeight());
orthoCamera.setClipRight(window->getWidth());
orthoCamera.setClipNear(-1.0f);
orthoCamera.setClipFar(1.0f);
orthoCamera.lookAt(
{0.0f, 0.0f, 0.0f},
{0.0f, 0.0f, -1.0f},
{0.0f, 1.0f, 0.0f});
orthoCamera.update();
yaw = 0.0f;
pitch = 0.0f;
mouseDown = false;
// Setup lighting
light.setColor({1.0f, 1.0f, 1.0f});
light.setPosition({0.0f, 2.5f, 4.0f});
light.setAttenuation({1.0f, 0.025f, 0.01f});
light.setDirection(-light.getPosition().normalized());
light.setCutoff(std::cos(math::radians<float>(30.0f)));
light.setExponent(20.0f);
plight.setColor(light.getColor());
plight.setPosition(light.getPosition());
plight.setAttenuation(light.getAttenuation());
sun.setColor({1.0f, 1.0f, 1.0f});
sun.setDirection(Vector<3, float>(0.75f, -0.5f, -1.0f).normalized());
// Add lights to scene
//scene.addChild(new SpotlightNode(&light));
scene.addChild(new DirectionalLightNode(&sun));
//scene.addChild(new PointLightNode(&plight));
// Add geometry to scene
scene.addChild(new GeometryNode(floor));
GeometryNode* objectNode = nullptr;
if (object->getSkeleton() && object->getSkeleton()->isLoaded())
{
// Pose
const Skeleton* skeleton = object->getSkeleton().get();
pose = new SkeletonPose(skeleton);
objectNode = new RiggedGeometryNode(object, pose);
}
else
{
objectNode = new GeometryNode(object);
}
//.........这里部分代码省略.........