63 lines
1.2 KiB
C++
63 lines
1.2 KiB
C++
// This only works with opengl!!!!
|
|
|
|
|
|
#include "TestTriangle.h"
|
|
|
|
|
|
|
|
TestTriangle::TestTriangle(Archimedes::App* a, void* h) : Archimedes::Module(a, h) {
|
|
|
|
name = "TestTriangle";
|
|
|
|
WindowModule* wm = new WindowModule(a, h);
|
|
deps[*wm] = wm;
|
|
}
|
|
|
|
TestTriangle::~TestTriangle() {
|
|
|
|
if(app) {
|
|
WindowModule* wm; { wm = (WindowModule*) moduleInstances[WindowModule()]; }
|
|
|
|
/*
|
|
#if WINDOW == 2
|
|
wm->removeEventFn(ecmd_it);
|
|
#endif
|
|
*/
|
|
wm->releaseWindow(window);
|
|
}
|
|
}
|
|
|
|
void TestTriangle::onLoad() {
|
|
// get window
|
|
WindowModule* wm; { wm = (WindowModule*) moduleInstances[WindowModule()]; }
|
|
|
|
if(!wm) {
|
|
std::cout << "No WindowModule for ImguiModule!\n";
|
|
std::abort();
|
|
}
|
|
|
|
window = wm->aquireWindow();
|
|
|
|
rt = window->getRenderer()->createRenderTarget(
|
|
vertices,
|
|
9 * sizeof(float),
|
|
indices,
|
|
3,
|
|
Archimedes::VertexLayout(),
|
|
vertexShaderSource,
|
|
fragmentShaderSource,
|
|
Archimedes::Shader::LoadType::FromSource
|
|
);
|
|
|
|
}
|
|
|
|
void TestTriangle::run() {
|
|
|
|
window->getRenderer()->draw(*rt);
|
|
|
|
}
|
|
|
|
bool TestTriangle::onEvent(const Archimedes::Event& e) {
|
|
return false;
|
|
}
|