stuff-from-scratch/test/graphics/TestDirectXRendering.cpp

37 lines
924 B
C++
Raw Normal View History

2023-01-05 13:16:52 +00:00
#include "TestCase.h"
#include "TestCaseRunner.h"
2023-01-05 16:40:27 +00:00
#include "TestUiApplication.h"
2023-01-05 13:16:52 +00:00
#include "TestFramework.h"
2023-01-05 16:40:27 +00:00
#include "DesktopManager.h"
#include "MeshPrimitives.h"
#include "MeshNode.h"
2023-01-05 16:57:46 +00:00
#include "TextNode.h"
2023-01-05 16:40:27 +00:00
#include "Scene.h"
#include "Widget.h"
2023-01-05 13:16:52 +00:00
#include <memory>
#include <string>
#include <iostream>
TEST_CASE(TestDirectXRendering, "graphics")
{
auto gui_app = TestCaseRunner::getInstance().getTestApplication();
2023-01-05 16:40:27 +00:00
auto drawing_context = gui_app->getDesktopManager()->getWindowManager()->getMainWindow();
auto scene = drawing_context->getScene();
auto mesh = MeshPrimitives::buildRectangleAsTriMesh();
2023-01-20 08:07:09 +00:00
auto mesh_node = std::make_unique<MeshNode>(Transform(DiscretePoint(0, 0)));
2023-01-05 16:40:27 +00:00
mesh_node->setMesh(mesh.get());
scene->addNode(mesh_node.get());
2023-01-05 16:57:46 +00:00
2023-01-20 08:07:09 +00:00
auto text_node = std::make_unique<TextNode>("Test", Transform(DiscretePoint(100, 100)));
2023-01-05 16:57:46 +00:00
scene->addNode(text_node.get());
2023-01-11 14:31:29 +00:00
scene->update();
2023-01-05 13:16:52 +00:00
gui_app->run();
};