GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
GameApiWorld.hh
Go to the documentation of this file.
1#include "GameApi.hh"
2#include <vector>
3
4using namespace GameApi;
5
7{
8public:
9 GameApiWorld(EveryApi &e) : e(e) { }
10 P get() const;
11
12 void push_box(float start_x, float end_x,
13 float start_y, float end_y,
14 float start_z, float end_z)
15 {
16 PT p1 = e.point_api.point(start_x, start_y, start_z);
17 PT p2 = e.point_api.point(end_x, start_y, start_z);
18 PT p3 = e.point_api.point(end_x, end_y, start_z);
19 PT p4 = e.point_api.point(start_x, end_y, start_z);
20 PT p5 = e.point_api.point(start_x, start_y, end_z);
21 PT p6 = e.point_api.point(end_x, start_y, end_z);
22 PT p7 = e.point_api.point(end_x, end_y, end_z);
23 PT p8 = e.point_api.point(start_x, end_y, end_z);
24 push_line(p1,p2);
25 push_line(p2,p3);
26 push_line(p3,p4);
27 push_line(p4,p1);
28
29 push_line(p5,p6);
30 push_line(p6,p7);
31 push_line(p7,p8);
32 push_line(p8,p5);
33
34 push_line(p1,p5);
35 push_line(p2,p6);
36 push_line(p3,p7);
37 push_line(p4,p8);
38 }
39
40 void push_line(PT p1, PT p2)
41 {
42 // polys.push_back(e.polygon_api.line(p1,p2));
43 }
44private:
45 EveryApi &e;
46 std::vector<P> polys;
47};
48
50{
51#if 0
52 e.shader_api.load("Shader.txt");
53 SH sh = e.shader_api.get_shader("texture", "texture", "");
54 e.shader_api.use(sh);
55 e.shader_api.set_default_projection(sh, "in_P");
56
57 e.mainloop_api.init(sh);
58 e.mainloop_api.antialias(true);
59
60
62 world.push_box(-100.0, 100.0,
63 -100.0, 100.0,
64 -100.0, 100.0);
65 P p = world.get();
66 e.polygon_api.preparepoly(p);
67
68 while(1) {
69 e.mainloop_api.clear();
70 e.polygon_api.renderpoly(p, 0.0,0.0,0.0);
71 e.mainloop_api.swapbuffers();
72 MainLoopApi::Event ev = e.mainloop_api.get_event();
73 if (ev.ch==27) break;
74 }
75#endif
76}
char world[]
Definition test.cpp:7
Env e
Definition Common.cc:2
EveryApi ev(e)
void GameApiWorldFunc(EveryApi &e)
Definition GameApiWorld.hh:49
Definition GameApiWorld.hh:7
P get() const
Definition GameApiWorld.cc:4
void push_box(float start_x, float end_x, float start_y, float end_y, float start_z, float end_z)
Definition GameApiWorld.hh:12
void push_line(PT p1, PT p2)
Definition GameApiWorld.hh:40
GameApiWorld(EveryApi &e)
Definition GameApiWorld.hh:9
Definition FreeType.hh:46
Definition GameApi.hh:4664
Definition GameApi.hh:791
Definition Common.hh:79
Definition GameApi.h:23
Definition GameApi.h:29