/ engine / test.cpp
test.cpp
 1  
 2  #include <enginend/engine.h>
 3  using namespace enginend;
 4  class launcher:public program {
 5  public:
 6  	
 7  	bool vsync = true;
 8  	scene s;
 9  	const char* CONF() final{return "test.tdf";}
10  	launcher(){};
11  	void boot() override {
12  		SetConfigFlags(FLAG_VSYNC_HINT);
13  		InitWindow(500,500,"test");
14  		SetTargetFPS(GetMonitorRefreshRate(GetCurrentMonitor()));
15  		this->tickrate=GetMonitorRefreshRate(GetCurrentMonitor());
16  		s.nodes=std::vector<nodes::node*>{
17  			
18  			new nodes::twod::colored(Color{255,255,255,255},0,0,500,500),
19  			new nodes::twod::textfield(nullptr,enginend::DEFAULT
20  								,100,100,220,32,32,
21  								"welcome to enginend!\n"
22  								"hehe"
23  			)
24  		};
25  		s.boot();
26  		
27  	}
28  	void tick() override {
29  		if (shouldtick()) {
30  			s.tick();
31  		}
32  	}
33  	void draw() override {
34  		s.draw();
35  	}
36  	void exit() override {
37  		s.exit();
38  	}
39  };
40  
41  tiny::ErrorLevel tiny::level{6};
42  int main(int argc, char *argv[]) {
43  	tiny::startup((char*)"enginend test",(char*)"1.0");
44  	launcher e;
45  	e.boot();
46  	while (!WindowShouldClose()) {
47  		e.tick();
48  		e.draw();
49  	}
50  	e.exit();
51  	return 0;
52  }