-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
70 lines (56 loc) · 1.31 KB
/
main.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
69
70
#include <cstdio>
#define CPPSG_REFCOUNT
#include <siege-cpp>
#include <cmath>
using namespace siege;
using namespace core;
using namespace type;
using namespace graphics;
using namespace input;
using namespace std;
class Box: public Entity
{
public:
Box(PSprite sprite, float x, float y, float angle = 0.0): Entity()
{
setSprite(sprite);
setPos(x, y);
setAngleDegs(angle);
}
void evMouseMove(SGint x, SGint y)
{
setPos(x, y);
}
} ;
RTYPE(Box);
int main()
{
core::init(0);
window::open(640, 480, 32, 0);
PSprite sprBox = new Sprite("data/sprites/CrateSmall.png");
PBox box = new Box(sprBox, 320, 240);
(void)box;
for(;;)
{
draw::clear();
if(!core::loop())
break;
draw::triangle(0, 0, 320, 240, 0, 240, true);
PTurtle turtle = new Turtle(320, 240);
turtle->penUp();
turtle->step(100);
turtle->turnLeftDegs(90);
turtle->penDown();
int segs = 32;
int i;
for(i = 0; i < segs; i++)
{
turtle->step(2 * M_PI * 100 / (float)segs / 2);
turtle->turnLeftDegs(360 / (float)segs);
turtle->step(2 * M_PI * 100 / (float)segs / 2);
}
window::swapBuffers();
}
core::deinit();
return 0;
}