<commit_before>#include "hudview.h"

// osg
#include <osgUtil/Optimizer>
#include <osgText/Text>
#include <osg/Material>
#include <osg/Geode>
#include <osg/BlendFunc>
#include <osg/Depth>
#include <osg/PolygonOffset>
#include <osg/MatrixTransform>
//#include <osg/Camera>
#include <osg/RenderInfo>
#include <osgText/Text>
#include <osgViewer/ViewerEventHandlers>
#include <osgViewer/View>
#include <osgGA/NodeTrackerManipulator>
#include <osg/Quat>
// troen
#include "../constants.h"


using namespace troen;

HUDView::HUDView(): m_trackNode(nullptr)
{
	AbstractView();
	m_speedText = new osgText::Text();
	m_healthText = new osgText::Text();
	m_pointsText = new osgText::Text();

	m_node = new osg::Group();

	m_node->addChild(createHUD());
	m_node->addChild(createRadar());
}

osg::Camera* HUDView::createHUD()
{
	// create a camera to set up the projection and model view matrices, and the subgraph to draw in the HUD
	m_camera = new osg::Camera;

	// set the projection matrix
	m_camera->setProjectionMatrix(osg::Matrix::ortho2D(0, DEFAULT_WINDOW_HEIGHT, 0, DEFAULT_WINDOW_WIDTH));
	m_camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
	m_camera->setViewMatrix(osg::Matrix::identity());
	m_camera->setClearMask(GL_DEPTH_BUFFER_BIT);
	// draw subgraph after main camera view.
	m_camera->setRenderOrder(osg::Camera::POST_RENDER);
	m_camera->setAllowEventFocus(false);

	{
		osg::Geode* geode = new osg::Geode();
		m_savedGeode = geode;

		osgText::Font *timesFont = osgText::readFontFile("../data/fonts/Tr2n.ttf");

		// turn lighting off for the text and disable depth test to ensure it's always ontop.
		osg::StateSet* stateset = geode->getOrCreateStateSet();
		stateset->setMode(GL_LIGHTING, osg::StateAttribute::OFF);

		osg::Vec3 position(500.f, 0, 0);
		osg::Vec3 delta(0.0f, -100.0f, 0.0f);

		{
			geode->addDrawable(m_speedText);

			m_speedText->setFont(timesFont);
			m_speedText->setPosition(position);
			setSpeedText(80);
			// m_speedText->setAlignment(osgText::Text::AlignmentType::RIGHT_BOTTOM);
<commit_msg>fonts working! arial for now<commit_after>#include "hudview.h"

// osg
#include <osgUtil/Optimizer>
#include <osgText/Text>
#include <osg/Material>
#include <osg/Geode>
#include <osg/BlendFunc>
#include <osg/Depth>
#include <osg/PolygonOffset>
#include <osg/MatrixTransform>
//#include <osg/Camera>
#include <osg/RenderInfo>
#include <osgText/Text>
#include <osgViewer/ViewerEventHandlers>
#include <osgViewer/View>
#include <osgGA/NodeTrackerManipulator>
#include <osg/Quat>
// troen
#include "../constants.h"


using namespace troen;

HUDView::HUDView(): m_trackNode(nullptr)
{
	AbstractView();
	m_speedText = new osgText::Text();
	m_healthText = new osgText::Text();
	m_pointsText = new osgText::Text();

	m_node = new osg::Group();

	m_node->addChild(createHUD());
	m_node->addChild(createRadar());
}

osg::Camera* HUDView::createHUD()
{
	// create a camera to set up the projection and model view matrices, and the subgraph to draw in the HUD
	m_camera = new osg::Camera;

	// set the projection matrix
	m_camera->setProjectionMatrix(osg::Matrix::ortho2D(0, DEFAULT_WINDOW_HEIGHT, 0, DEFAULT_WINDOW_WIDTH));
	m_camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
	m_camera->setViewMatrix(osg::Matrix::identity());
	m_camera->setClearMask(GL_DEPTH_BUFFER_BIT);
	// draw subgraph after main camera view.
	m_camera->setRenderOrder(osg::Camera::POST_RENDER);
	m_camera->setAllowEventFocus(false);

	{
		osg::Geode* geode = new osg::Geode();
		m_savedGeode = geode;

		osgText::Font *timesFont = osgText::readFontFile("fonts/arial.ttf");

		// turn lighting off for the text and disable depth test to ensure it's always ontop.
		osg::StateSet* stateset = geode->getOrCreateStateSet();
		stateset->setMode(GL_LIGHTING, osg::StateAttribute::OFF);

		osg::Vec3 position(500.f, 0, 0);
		osg::Vec3 delta(0.0f, -100.0f, 0.0f);

		{
			geode->addDrawable(m_speedText);

			m_speedText->setFont(timesFont);
			m_speedText->setPosition(position);
			setSpeedText(80);
			// m_speedText->setAlignment(osgText::Text::AlignmentType::RIGHT_BOTTOM);

{'fraction_non_alphanumeric': 0.150049115913556, 'fraction_numerical': 0.01006876227897839, 'mean_word_length': 5.986277873070326, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 61, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1967934', 'n_tokens_mistral': 1602, 'n_tokens_neox': 1521, 'n_words': 288}