flake parts
This commit is contained in:
66
src/modules/Archimedes-Modules/TestTriangle/TestTriangle.cpp
Normal file
66
src/modules/Archimedes-Modules/TestTriangle/TestTriangle.cpp
Normal file
@@ -0,0 +1,66 @@
|
||||
// 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);
|
||||
|
||||
delete rt;
|
||||
}
|
||||
}
|
||||
|
||||
void TestTriangle::onLoad() {
|
||||
// get window
|
||||
WindowModule* wm; { wm = (WindowModule*) moduleInstances[WindowModule()]; }
|
||||
|
||||
if(!wm) {
|
||||
std::cout << "No WindowModule TestTriangle!\n";
|
||||
std::abort();
|
||||
}
|
||||
|
||||
window = wm->aquireWindow();
|
||||
|
||||
window->getRenderer()->clearColor = { 0.2, 0.2, 0.4, 0.7 };
|
||||
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user