forked from adoptware/pinball
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtrans.cpp
68 lines (59 loc) · 1.75 KB
/
trans.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/***************************************************************************
Transparency test.
***************************************************************************/
#include <iostream>
#include "Private.h"
#include "Engine.h"
#include "Camera.h"
#include "Cube.h"
#include "KeyRotBehavior.h"
#include "KeyBehavior.h"
#include "Keyboard.h"
#include "Light.h"
#include "Polygon.h"
/** Main */
int main(int argc, char *argv[]) {
cerr << "Simple emilia test." << endl;
// create the engine.
Engine* engine = new Engine(argc, argv);
engine->setLightning(0.5f, 0.1f);
// add a camera. Move a bit.
Camera* camera = new Camera();
Group* groupCamera = new Group();
engine->add(groupCamera);
groupCamera->setCamera(camera);
groupCamera->setTranslation(0, 0, 3);
engine->setEngineCamera(groupCamera);
// add cubes
Cube* cube1 = new Cube(1.0f, 1.0f, 0.0f, 0.0f, 0.5f);
Cube* cube2 = new Cube(1.0f, 0.0f, 0.0f, 1.0f, 0.5f);
Group* groupCube1 = new Group();
Group* groupCube2 = new Group();
engine->add(groupCube1);
engine->add(groupCube2);
groupCube1->addShape3D(cube1);
groupCube2->addShape3D(cube2);
cube1->setPolygonProperty(EM_POLY_TRANS);
cube1->setProperty(EM_SHAPE3D_USE_TRANS);
cube2->setPolygonProperty(EM_POLY_TRANS);
cube2->setProperty(EM_SHAPE3D_USE_TRANS);
// add behaviors to the cubes
KeyRotBehavior* keyRBeh = new KeyRotBehavior();
groupCube1->setBehavior(keyRBeh);
KeyBehavior* keyBeh = new KeyBehavior();
groupCube2->setBehavior(keyBeh);
engine->resetTick();
while (!Keyboard::isKeyDown(SDLK_ESCAPE)) {
if (engine->nextTick()) {
engine->tick();
} else {
engine->render();
engine->swap();
}
}
engine->stopEngine();
return 0;
}
#if EM_USE_ALLEGRO
END_OF_MAIN();
#endif